pwnall / chromeview

Proof of concept Android WebView implementation based on Chromium code
1.69k stars 434 forks source link

No implementation found? #46

Closed alongubkin closed 10 years ago

alongubkin commented 10 years ago

I'm trying to run chromeview and when I call ChromeView.initialize an UnsatsifiedLinkError exception is thrown.

12-31 16:16:28.050: D/dalvikvm(4910): Late-enabling CheckJNI
12-31 16:16:28.155: I/LibraryLoader(4910): loading: webviewchromium
12-31 16:16:28.155: D/dalvikvm(4910): Trying to load lib /data/app-lib/com.example.chromeviewtest-1/libwebviewchromium.so 0x41c443c0
12-31 16:16:28.155: D/dalvikvm(4910): **Added shared lib /data/app-lib/com.example.chromeviewtest-1/libwebviewchromium.so 0x41c443c0
12-31 16:16:28.155: I/LibraryLoader(4910): loaded: webviewchromium
12-31 16:16:28.155: W/dalvikvm(4910): No implementation found for native Lorg/chromium/content/app/LibraryLoader;.nativeLibraryLoaded:([Ljava/lang/String;)I
12-31 16:16:28.155: D/AndroidRuntime(4910): Shutting down VM
12-31 16:16:28.155: W/dalvikvm(4910): threadid=1: thread exiting with uncaught exception (group=0x41995c50)
12-31 16:16:28.160: E/AndroidRuntime(4910): FATAL EXCEPTION: main
12-31 16:16:28.160: E/AndroidRuntime(4910): Process: com.example.chromeviewtest, PID: 4910
12-31 16:16:28.160: E/AndroidRuntime(4910): java.lang.UnsatisfiedLinkError: Native method not found: org.chromium.content.app.LibraryLoader.nativeLibraryLoaded:([Ljava/lang/String;)I
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.content.app.LibraryLoader.nativeLibraryLoaded(Native Method)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.content.app.LibraryLoader.initializeAlreadyLocked(LibraryLoader.java:122)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.content.app.LibraryLoader.ensureInitialized(LibraryLoader.java:63)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.android_webview.AwBrowserProcess$1.run(AwBrowserProcess.java:50)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.base.ThreadUtils.runOnUiThreadBlocking(ThreadUtils.java:28)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at org.chromium.android_webview.AwBrowserProcess.start(AwBrowserProcess.java:46)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at us.costan.chrome.impl.ChromeInitializer.initialize(ChromeInitializer.java:49)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at us.costan.chrome.ChromeView.initialize(ChromeView.java:851)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at com.example.chromeviewtest.MyApplication.onCreate(MyApplication.java:10)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
12-31 16:16:28.160: E/AndroidRuntime(4910):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4396)

These are the steps I did:

What is the problem? How can I fix it?

alongubkin commented 10 years ago

The problem was that chromeview doesn't work on Android 4.4, but since WebView is backed by Chromium in 4.4, I'll just make 2 different apks, one for earlier OS version and one for 4.4.

kashban commented 10 years ago

There is no need to create two different APKs. Just select the engine based on the OS version.

In your Activity.onCreate:

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // For Android 4.0-4.3 use ChromeView because WebView is too bugged if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { ChromeView.initialize(this); ChromeView chromeView = new ChromeView(webnachrichten.this);

        ChromeSettings settings = chromeView.getSettings(); 
        settings.setJavaScriptEnabled(true); 
        settings.setDatabaseEnabled(true); 
        settings.setDomStorageEnabled(true);
        setContentView(chromeView);
    }
    super.loadUrl(Config.getStartUrl());
}