问题
I am using sencha touch with phonegap/cordova to build the android app. When my app starts up i get a white screen with something along the lines of 'MyApp, unfortunatly, has stopped.' How and where do i add the Chromium WebView?
The logs below says it missing Chromium WebView but i can't seem to figure out where that is or what to add to that.
I have found http://docs.phonegap.com/en/3.0.0/guide_platforms_android_webview.md.html but is cordovaWebView the same as Chromium? Also the doc seems to be out of date.
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>
Small script i run for the builds
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:
"is cordovaWebView the same as Chromium" - Yes, it should be. And the most recent version of that doc is here.
Your best bet is to build the Sencha Touch application using the Cordova CLI or Sencha Cmd as all of the WebView setup is automagically done for you.
I'm not entirely sure how to fix your existing setup, but I would definitely encourage you to use one of the two aforementioned CLI tools... it reduces the likelihood of errors like this.
来源:https://stackoverflow.com/questions/25003504/android-app-failing-to-start-missing-chromium-webview