简体   繁体   English

Android应用无法开始丢失Chromium WebView

[英]Android app failing to start missing Chromium WebView

I am using sencha touch with phonegap/cordova to build the android app. 我正在将sencha touch与phonegap / cordova一起使用来构建android应用。 When my app starts up i get a white screen with something along the lines of 'MyApp, unfortunatly, has stopped.' 当我的应用程序启动时,出现类似“ MyApp,不幸的是已停止”之类的东西的白屏。 How and where do i add the Chromium WebView? 如何以及在何处添加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. 下面的日志说它缺少Chromium WebView,但我似乎无法弄清楚那是哪里或要添加什么。

I have found http://docs.phonegap.com/en/3.0.0/guide_platforms_android_webview.md.html but is cordovaWebView the same as Chromium? 我找到了http://docs.phonegap.com/en/3.0.0/guide_platforms_android_webview.md.html,但cordovaWebView与Chromium相同吗? Also the doc seems to be out of date. 而且该文档似乎已经过时了。

LogCat 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 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 "

"is cordovaWebView the same as Chromium" - Yes, it should be. “ cordovaWebView与Chromium是否相同”-是的,应该是。 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. 最好的选择是使用Cordova CLISencha Cmd构建Sencha Touch应用程序,因为所有WebView设置都是为您自动完成的。

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. 我不确定如何解决您现有的设置,但我绝对会鼓励您使用上述两个CLI工具之一...这样可以减少发生此类错误的可能性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM