Chromium WebView不存在 [英] Chromium WebView does not exist

查看:1506
本文介绍了Chromium WebView不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Phonegap创建一个Hello World应用程序,但它崩溃时,我调用运行仿真器上的应用程序。我按照此处的指南操作。这里是我对MainActivity.java的:

I am trying to create a Hello World app using Phonegap but it crashes when I call run the application on emulator. I followed the guideline here. Here is what I have on 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:

Here is my 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>

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

Here is the first errors I get :


  1. Chromium WebView不存在

  2. FATAL EXCEPTION:main

  3. java.lang.RuntimeException:无法启动活动
    ComponentInfo {com.example.deneme / com.example.deneme.MainActivity}:
    java.lang.UnsupportedOperationException

你能告诉我应用程序有什么问题吗?感谢。

Can you tell me what is wrong with the application? Thanks.

推荐答案

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

Actually, not every Android phone ships with Chromium as WebView engine (https://developer.chrome.com/multidevice/webview/overview). For instance, my Samsung Galaxy Ace2 with Android 4.1.2 has old WebView engine. User agent string denotes some unknown Mozilla version, HTML5 apps look&feel and behavior differs from Chrome. However, PhoneGap apps do not raise errors on my phone.

我不知道你为什么得到Chromium WebView不存在的错误,重新开始你的方式(因为你正在尝试使用Phonegap构建Hello World应用程序)我想指向另一个选项。使用 Crosswalk 项目,您不必处理每个Android设备上的各种WebView引擎,而是使用嵌入在您的应用程序chrome引擎 - 总是相同的每个android设备。人行横道项目可用于Android和tizen平台。因此,为了构建交叉平台应用程序(Android和iOS),我建议使用

I don't know why you're getting "Chromium WebView does not exist" error, but since you're on the very beginnig on your way (cause you're trying to build Hello World app using Phonegap) I want to point to another option. Using Crosswalk project allows you not to deal with various WebView engines on every android device but use embedded in your app chromium engine - always the same on every android device. The crosswalk project is available for android and tizen platforms. So to build crossplatform app (android an iOS) I would suggest to use either


  • Intel XDK ,它可以使用带有XDK api和Cordova api的单个html5源代码,可以使用crosswalk编译为Android应用程序或使用本地WebView编译为iOS。

  • Crosswalk + Cordova 构建Android应用和PhoneGap以构建iOS应用相同的来源

  • Intel XDK, which can use single html5 source code with XDK api and Cordova api, that can be compiled to android app using crosswalk or compiled to iOS using native WebView.
  • Crosswalk+Cordova to build android app and PhoneGap to build iOS app from the same sources

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

This approach can eliminate pain on supporting various android devices.

另请参阅:

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

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

这篇关于Chromium WebView不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆