Issue
I have just created an API 23 emulator on my machine:
- HAXM: v1.4 with 1GB allocated RAM
- AVD Base: Nexus 4
- RAM: 768MB, and 896MB in a second try
- Heap: 64 MB
- GPU acceleration: no
I tried it successfully with a few apps of my own. But each time I try an application that uses a WebView
as a UI, the app crashes that way:
The three first line of this logcat are the only pertaining to my app (highlighted in blue). All other lines do not mention my application package's name in the 'Application' column of LogCat, but one does in the middle of the message (circled in blue).
I can load the HTML code into the WebView
. The crash occurs at setContentView(theWebView)
time:
public class MyActivity extends Activity {
private WebView mWebview = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mWebview = new WebView(this);
mWebview.loadDataWithBaseURL("file:///android_asset/", HTML_CODE, "text/html", "UTF-8", null);
setContentView(mWebview); // THIS IS WHERE THE CRASH OCCURS
}
[...]
Using or not using runOnUiThread()
to run mWebview.loadDataWithBaseURL()
produces exactly the same result, which is expected as onCreate()
is actually on the UI thread.
The html code I am using does not change anything. In the case above, the HTML_CODE
variable contains this:
<html>
<head></head>
<body>
<h1>Hello</h1>
<p>Hello world!</p>
</body>
</html>
The app runs perfectly, even with a more advanced HTML+CSS+JS+JS<->Java binding code on all the API 17 and 19 devices and emulators I tried. This is where I'm puzzled. I didn't have a chance to try with an actual Android 6.0 (API 23) device though.
EDIT
I have just :
- migrated from Eclipse to Android Studio
- upgraded HAXM to v1.5
- upgraded my SDK Tools (24.4.1) and my platform (23.0.1)
The problem still occurs but the log is different, and a bit clearer. There is a ClassNotFoundException
I cannot explain:
10-28 20:26:05.102 2168-2168/com.example.myapp W/System: ClassLoader referenced unknown path: /data/app/com.example.myapp-1/lib/x86
10-28 20:26:08.583 2168-2168/com.example.myapp E/DataReductionProxySettingListener: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
10-28 20:26:09.393 2168-2213/com.example.myapp W/chromium: [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup
10-28 20:26:12.521 2168-2286/com.example.myapp A/chromium: [FATAL:gl_surface_android.cc(58)] Check failed: kGLImplementationNone != GetGLImplementation() (0 vs. 0)
10-28 20:26:12.521 2168-2286/com.example.myapp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 2286 (GpuThread)
Any idea? (I'm investigating further so I will update this post should I find anything relevant)
Solution
This behaviour was not caused by any erroneous setting of the AVD or any missing prerequisite (harware, etc...).
As cryptojuice mentioned in comments this was caused by an OpenGL ES prerequisite issue on emulator side:
Unfortunately OpenGL ES 2.0 support has been mandatory for devices since at least Android 4.0, so we haven't ever explicitly supported GLES 1.x at all and it was only working before by accident :/
It seems a bit problematic that the emulator (without host GPU emulation) doesn't meet the minimum requirements for Android devices.
We might be able to work around this for the emulator at a significant performance cost; we're talking to the emulator team about what the best thing to do here is.
Now this is fixed (SDK tools 25.1 RC1 / platform 23 rev 3), even though this doesn't appear on the ticket linked above.
Answered By - Shlublu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.