Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chromium WebView does not exist

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");
    }
}

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 does not exist
  2. FATAL EXCEPTION: main
  3. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.deneme/com.example.deneme.MainActivity}: java.lang.UnsupportedOperationException

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

like image 687
jason Avatar asked Jul 29 '14 16:07

jason


1 Answers

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.

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, 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

This approach can eliminate pain on supporting various android devices.

See also:

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

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

like image 159
Ivan Samygin Avatar answered Sep 30 '22 07:09

Ivan Samygin