我正在使用Android SDK 15使用phonegap" 2.0",我只想在Android Project上嵌入Cordova WebView,我逐步使用了指南链接,在GitHub链接中也使用了另一个示例我运行时我的应用程序崩溃并自动停止。logcat错误:
android.view.InflateException: Binary XML file line #6: Error inflating class org.apache.cordova.CordovaWebView
我的XML文件 " main.xml":
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">
<org.apache.cordova.CordovaWebView android:id="@+id/phoneGapView" android:layout_width="fill_parent" android:layout_height="fill_parent" />
</LinearLayout >
提前..:)
您可能有与我相同的错误。一旦我在活动中实现了从Cordovainterface派生的方法,尤其是GetActivity方法,应用程序就可以了。
@Override
public Activity getActivity() {
return this;
}
请注意,默认实现将返回null,而Cordovawebview最有可能需要适当的活动实例来进行初始化。
注意:我正在使用PhoneGap 2.1.0