【问题标题】:Chromium WebView does not existChromium WebView 不存在
【发布时间】:2014-07-29 16:00:08
【问题描述】:

我正在尝试使用 Phonegap 创建一个 Hello World 应用程序,但是当我调用在模拟器上运行应用程序时它会崩溃。我遵循了here 的指导方针。这是我在 MainActivity.java 上的内容:

  package com.example.hello;

import android.os.Bundle;
import org.apache.cordova.*;

public class HelloWorld extends CordovaActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html");
    }
}

这是我的 AndroidManifest.xml:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.example.hello" 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" />
    <application 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:launchMode="singleTop" android:name="HelloWorld" 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="10" android:targetSdkVersion="20" />
</manifest>

这是我得到的第一个错误:

  1. Chromium WebView 不存在
  2. 致命异常:主要
  3. java.lang.RuntimeException:无法启动活动 组件信息{com.example.deneme/com.example.deneme.MainActivity}: java.lang.UnsupportedOperationException

你能告诉我申请有什么问题吗?谢谢。

【问题讨论】:

  • DroidGap 不是已弃用吗?另外,您是否正确创建了 phonegap 项目?当我说得正确时,我的意思是像here所描述的那样。
  • @XaverKapeller 我遵循了一个过时的指南,谢谢你的链接..
  • @XaverKapeller 我已经创建了链接中准确描述的phonegap。我仍然遇到同样的错误..
  • 您是否尝试在读取设备上启动应用程序?

标签: java android cordova


【解决方案1】:

实际上,并非每部 Android 手机都配备 Chromium 作为 WebView 引擎 (https://developer.chrome.com/multidevice/webview/overview)。例如,我的带有 Android 4.1.2 的三星 Galaxy Ace2 有旧的 WebView 引擎。用户代理字符串表示某些未知的 Mozilla 版本,HTML5 应用程序的外观和行为与 Chrome 不同。但是,PhoneGap 应用程序不会在我的手机上引发错误。

我不知道您为什么会收到“Chromium WebView 不存在”错误,但由于您正处于起步阶段(因为您正在尝试使用 Phonegap 构建 Hello World 应用程序)我想要指向另一个选项。使用 Crosswalk 项目可以让您不必在每个 android 设备上处理各种 WebView 引擎,而是使用嵌入在您的应用程序中的 chromium 引擎 - 在每个 android 设备上始终相同。 crosswalk 项目可用于 android 和 tizen 平台。因此,要构建跨平台应用程序(Android 和 iOS),我建议使用任一

  • Intel XDK,可以使用单个 html5 源代码与 XDK api 和 Cordova api,可以使用 crosswalk 编译到 android 应用程序或使用原生 WebView 编译到 iOS。
  • Crosswalk+Cordova 构建 android 应用和 PhoneGap 从相同来源构建 iOS 应用

这种方法可以消除支持各种安卓设备的痛苦。

另见:

http://html5hub.com/building-cordova-applications-with-crosswalk/

https://groups.google.com/forum/#!topic/phonegap/IxSuRUScbMs

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多