Android应用未能开始缺少Chromium WebView

时间:2014-07-28 20:11:26

标签: android cordova sencha-touch

我正在使用带有phonegap / cordova的sencha touch来构建Android应用程序。当我的应用程序启动时,我得到一个白色的屏幕,上面写着“MyApp,不幸的是,已经停止了”。我如何以及在何处添加Chromium WebView?

下面的日志显示它缺少Chromium WebView,但我似乎无法弄清楚那是什么或者添加到那里。

我找到http://docs.phonegap.com/en/3.0.0/guide_platforms_android_webview.md.html但是cordovaWebView和Chromium一样吗?该文件似乎也已过时。

logcat的

07-28 16:45:21.433: I/ActivityManager(1234): Start proc org.MyApp.mMyApp for activity org.MyApp.mMyApp/.mMyApp: pid=1672 uid=10019 gids={50019, 3003, 1028, 1015}
07-28 16:45:21.453: I/CordovaLog(1672): Changing log level to DEBUG(3)
07-28 16:45:21.453: D/CordovaActivity(1672): CordovaActivity.onCreate()
07-28 16:45:21.453: E/WebViewFactory(1672): Chromium WebView does not exist
07-28 16:45:21.453: E/WebViewFactory(1672): Chromium WebView does not exist
07-28 16:45:21.453: D/AndroidRuntime(1672): Shutting down VM
07-28 16:45:21.453: W/dalvikvm(1672): threadid=1: thread exiting with uncaught exception (group=0xb0e0cce8)
07-28 16:45:21.463: E/AndroidRuntime(1672): FATAL EXCEPTION: main
07-28 16:45:21.463: E/AndroidRuntime(1672): Process: org.MyApp.mMyApp, PID: 1672
07-28 16:45:21.463: E/AndroidRuntime(1672): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.MyApp.mMyApp/org.MyApp.mMyApp.mMyApp}: java.lang.UnsupportedOperationException
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread.access$800(ActivityThread.java:138)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.os.Handler.dispatchMessage(Handler.java:102)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.os.Looper.loop(Looper.java:136)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread.main(ActivityThread.java:5026)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at java.lang.reflect.Method.invokeNative(Native Method)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at java.lang.reflect.Method.invoke(Method.java:515)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at dalvik.system.NativeStart.main(Native Method)
07-28 16:45:21.463: E/AndroidRuntime(1672): Caused by: java.lang.UnsupportedOperationException
07-28 16:45:21.463: E/AndroidRuntime(1672):     at com.android.webview.nullwebview.NullWebViewFactoryProvider.createWebView(NullWebViewFactoryProvider.java:41)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.ensureProviderCreated(WebView.java:2058)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.setOverScrollMode(WebView.java:2116)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.view.View.<init>(View.java:3461)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.view.View.<init>(View.java:3517)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.view.ViewGroup.<init>(ViewGroup.java:470)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:52)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.<init>(WebView.java:498)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.<init>(WebView.java:475)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.<init>(WebView.java:455)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.<init>(WebView.java:444)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.webkit.WebView.<init>(WebView.java:434)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at org.apache.cordova.CordovaWebView.<init>(CordovaWebView.java:137)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:314)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:349)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at org.MyApp.mMyApp.mMyApp.onCreate(mMyApp.java:31)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.Activity.performCreate(Activity.java:5242)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-28 16:45:21.463: E/AndroidRuntime(1672):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
07-28 16:45:21.463: E/AndroidRuntime(1672):     ... 11 more

Android manifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0.0" android:windowSoftInputMode="adjustPan" package="org.MyApplication.mMyApplication" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="mMyApplication" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="20" />
</manifest>

我为构建运行的小脚本

import os
# run a build for this app
os.system("sencha -d app build -run native");
# change directory into phonegap directory
os.chdir( os.getcwd() + "\phonegap" );
# push the app to the device
os.system("phonegap run android");
print " Script Complete "

1 个答案:

答案 0 :(得分:0)

&#34;是与Chromium相同的cordovaWebView&#34; - 是的,它应该是。该文档的最新版本为here

您最好的选择是使用Cordova CLISencha Cmd构建Sencha Touch应用程序,因为所有WebView设置都是自动完成的。

我不完全确定如何修复您现有的设置,但我绝对鼓励您使用上述两种CLI工具中的一种......它可以减少出现此类错误的可能性。