Very simple WebView crashes under API 23 Emulator - android

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)

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:
#8 ...#chromium.org
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.

Related

.net MAUI application fails to launch on local arm64-v8a device

I've developed MAUI application. Eveything works perfectly on emulator and I want to try it out on my Xiaomi Redmi note 9. But it fails with:
Loaded assembly: /data/data/com.companyname.mauieventsamplecs/files/.__override__/System.Numerics.Vectors.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly lt-LT/System.Private.CoreLib.resources.dll
[chatty] uid=10359(com.companyname.mauieventsamplecs) identical 2 lines
[monodroid-assembly] open_from_bundles: failed to load assembly lt-LT/System.Private.CoreLib.resources.dll
[uieventsamplec] Process terminated due to "Infinite recursion during resource lookup within System.Private.CoreLib. This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: IO_FileName_Name"
[libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 1418 (uieventsamplecs), pid 1418 (uieventsamplecs)
I pinpointed that it's the problem of different CPU. By default, the app is building on Any CPU (emulator runs x86_64 system). Which I would hope should include arm64-v8a, but it seems to only include all Intel CPU. Tried launching arm64-v8a emulator, but it's not supported since my device is Intel and not AMD
I tried changeing solution platform to ARM64, but ether that did not help or, you need to something more than just adding new solution platform and assigning it to actually make it work.
So my question is: how one should set up the MAUI to launch on local arm64-v8a if that's even possible.
Turns out it was the problem based on lt-LT/System.Private.CoreLib.resources.dll After few days of debugging and finally switching my phone language from LT to US in my phone settings it fixed the problem.
Try set in MauiApp1.csproj
<PropertyGroup Condition="$(TargetFramework.Contains('-android')) and '$(Configuration)' == 'Release'">
<!--<RuntimeIdentifiers>android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>-->
<RuntimeIdentifiers>android-arm;android-arm64</RuntimeIdentifiers>
</PropertyGroup>

Upgrading cordova 3.6.4 to 5.2.2 in Android

I have an app in cordova 3.6.4 and I'm trying to upgrade it to 5.2.2. Everything seemed to work quite find with the UI however with the java files there is a problem.
I fixed some errors in the compilation time and the application now seems to open. However there are some errors that makes the app crash in run time.
Some of the errors are:
09-08 17:40:56.675 9729-9729/myapp E/chromium: [ERROR:layer_tree_host_impl.cc(2218)] Forcing zero-copy tile initialization as worker context is missing
09-08 17:43:17.535 9729-9729/myapp /chromium: [ERROR:xwalk_autofill_client.cc(121)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()
09-08 17:43:34.185 9729-9821/myapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 9821 (Chrome_InProcRe)
The application crashes when I start writing on an input element. I have tried to catch the event in chrome but without any success.
Any ideas?
Thanks
I have found in the code the reason why the app was crashing.
WebView webView = (WebView) appView.getEngine().getView();
This code gives the following error:
org.crosswalk.engine.XWalkCordovaView cannot be cast to org.apache.cordova.engine.SystemWebView
And the I had been using
WebView.setWebContentsDebuggingEnabled(true);
which is giving as an error what I mentioned before.
It seems that with the crosswalk you can't change much if its settings.
And I was using it in the older version of cordova to overpass a ssl certificate error.

Fatal signal 11 (SIGSEGV), code 2, fault addr 0x37acd7ac in tid 14358

I just run into s problem.When I changed my gradle version to 2.1.0(old version is 1.5.0),my code went wrong.And it's wierd there is no logcat,so I just don't know how to find the problem and the wrong part code. I have tryed to add android:allowClearUserData="true" in my AndroidManifest .it turns out not working. when I change my gradle version to the old one,it goes well.I am a new coder,and I use Retrofit to do the network job.plz just help me.Oh and I open the OpenGL stack in the logcat,It will call glGetError() then it goes crush.
From your description, I have no idea. If only upgrading AS, it should be not crashed, but for possible updated SDK or Build tool Env. If you back to 1.5, even no crash when using same platform sdk, support library sdk?
After upgrading 2.1.0, When was crash happened? launching app, or opening some Activity? If later, you should limit your code to some extension, then searching from Google.
From crash info, it should be related with JNI. if you use JNI,your app has a library path in the app installed directory to list all support ABI .so. You could found the differ btw woking machine and abnormal one. From this stackOverflow, you can try too.

Provisioning Nymi band from Android app

I am trying to provision the Nymi band from my android app. I am using the sample code from the Nymi Android SDK 2.0 (Can be downloaded from here:). I removed all the code related to the Nymulator(Nymi band emulator). I want to test the provisioning with the real Nymi band. However,when I click the provision button, the app get crashed. I tried to debug it with the exception breakpoints and I got the "getsockopt errno 88" error in my debugger:
I am attaching the screenshot too.
I did some research on google , and found that the errno 88 is
#define ENOTSOCK 88 /* Socket operation on non-socket */
During the app launch, I see the following message in the Debug Console:
Connected to the target VM, address: 'localhost:8604', transport: 'socket'
which I think,the connection to socket is fine. I am not sure,what makes the socket connection go wrong later.
This is what I see in my LOgCat after I click the provision button:(I am posting only some part of the error message,because the error message in Logcat is way too long)
Edit: I added some breakpoints,and I found where the app is crashing. I found this code:
try {
System.loadLibrary("_nymi_sdk_net");
_loaded = true;
} catch (UnsatisfiedLinkError var6) {
return false;
}
At system.load library, I am getting the error.
Edit 2: I changed the libraries from net to native ,as net is for emulators and native is for device. This time new error occurs at the same line:System.loadLibrary("_nymi_sdk");
Screenshot:
(Disclaimer: I know nothing of this SDK or the band, and this answer is just a speculation. And I've deleted my earlier answer as it was a missed shot in the dark.)
There is a minor hint in the SDK's README.md:
Prerequisites:
Android Development:
[...]
To use the BasicExample app with a Nymi Band, the NCL library in Examples\BasicExample\libs must be replaces with the native library in
NCL\native\libs
You must remove all files and folders from BasicExample\libs and copy all files from NCL\native\libs there instead.
(I wonder why they didn't emphasize this much harder...)
So the libs folder should contain the following folders and files:

Problems with build.xml when using the Android ADK to communicate with an Arduino Mega ADK

So a few days ago I got my hands on an Arduino Mega ADK board, and the last couple of nights I have been setting up my development environment, getting to grips with the tools etc. The tools and libraries all work fine, for example I can get a program written in the Processing IDE to compile and run on an Asus Eee Pad Transformer TF101 running Android 4.03. But when I get it to try to compile and run one of the pre-written examples, it gives me a compiler error:
Android SDK Tools Revision 20
Installed at C:\NVPACK\android-sdk-windows
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
BUILD FAILED
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:680: The following error occurred while executing this line:
C:\NVPACK\android-sdk-windows\tools\ant\build.xml:693: Compile failed; see the compiler error output for details.
Total time: 7 seconds
And that's all the console seems to output as well, which is rather frustrating! As far as I'm aware all of my SDK versions, tools and plugins are all up to date. I've tried this using a Linux partition I have on my hard drive and it produces the same error message, although it mentions a problem with the package com.Android.future.UsbAccessory. Given what I've seen, it seems that the problem is with the tools, either my directory structure doesn't match up to what the correct setup is, or something else is wrong :S. If anyone has had similar problems, some help would be smashing! (For the record, my setup was done using the instructions on the Arduino website, although I already had the Android SDK tools installed).
Will Scott-Jackson
It sounds like your haven't added in the support library to your project and/or you haven't downloaded it into your Android SDK.
The ADK1 demokit app targets API Level 10 (Android 2.3.3); That means you need to use the support libraries in your project and that's why the compiler is complaining about level 10 library dependencies not being available. The support libraries are a separate download in the SDK Manager, so you might not have them in your development environment.
In Android API Level 12 and higher, the USB Accessory protocol was added to the framework API, so there are two different ways to use the accessory protocol. So, you don't have to use the support libraries if you are targeting Honeycomb and higher versions, but you'll have to update the demokit app code to make this work.
Hope this helps.
So I've double checked my setup and started working on a project I had in mind, it seems to import the libraries appropriately. So far so good, but when I input:
ArduinoAdkUsb arduino;
void setup() {
arduino = new ArduinoAdkUsb(this);
//Other UI initialisation etc.
}
I get this error:
##name## ##version## by ##author##
FATAL EXCEPTION: Animation Thread
java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
at cc.arduino.ADKCommunication.<init>(Unknown Source)
at cc.arduino.ArduinoAdkUsb.<init>(Unknown Source)
at
processing.android.test.sketch_120730a.
sketch_120730a.setup(sketch_120730a.java:48)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
After the app has been built and installed onto the Android tablet I am using. Any thoughts how I can over come this? From what I can tell, this has no problem finding com.android.future.usb.manager to compile and install the program, but once it tries to run it can find it.
Based on this tutorial from http://stream.tellart.com/controlling-arduino-with-android/
In the examples RGB_Arduino the name, version and author variables are set at the top of the sketch.
Try adding in this section of code at the top of your arduino sketch just underneath the library imports
// accessory descriptor. It's how Arduino identifies itself to Android
char applicationName[] = "Mega_ADK"; // the app on your phone
char accessoryName[] = "Mega_ADK"; // your Arduino board
char companyName[] = "Freeware";
// make up anything you want for these
char versionNumber[] = "1.0";
char serialNumber[] = "1";
char url[] = "http://labs.arduino.cc/adk/"; // the URL of your app online
//initialize the accessory:
AndroidAccessory usb(companyName, applicationName,
accessoryName,versionNumber,url,serialNumber);

Categories

Resources