我正在使用带有Android SDK 15的phonegap"2.0",我只想在Android prject上嵌入Cordova WebView,我一步一步地使用指南链接,也是github中的另一个例子链接 我的应用程序崩溃并在我运行时自动停止.Logcat错误:
android.view.InflateException: Binary XML file line #6: Error inflating class org.apache.cordova.CordovaWebView
Run Code Online (Sandbox Code Playgroud)
我的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 >
Run Code Online (Sandbox Code Playgroud)
Thx提前.. :)
Don*_*eep 20
您可能会遇到与我相同的错误.一旦我在我的活动中实现了从CordovaInterface派生的方法,特别是getActivity方法,应用程序就开始了.
@Override
public Activity getActivity() {
return this;
}
Run Code Online (Sandbox Code Playgroud)
请注意,默认实现返回null,而CordovaWebView很可能需要一个适当的Activity实例进行初始化.
注意:我使用的是PhoneGap 2.1.0
| 归档时间: |
|
| 查看次数: |
5433 次 |
| 最近记录: |