Search code examples
androidcrashwebglandroid-gradle-3.0android-architecture

Android - Xwalk crash after Oreo migration


I want to make some changes to an application targeting Android SDK 22 (5.1).

I loaded the project in Android Studio 3, got the Gradle upgrade message. Of course, doing that makes the whole thing explode as the way the new Gradle handles dependencies has become very nitpicky. I decided to go all out and just do the whole migration. Would have to do it at some point anyway.

The application uses an XWalkView (extended in a class), instead of the native Webview, as we want to have some WebGL running. The Xwalk is being embedded and not shared.

Just by updating the Gradle files to newest Libs, basically change the Android support to latest and target SDK, makes the application crash on startup (directly crash message) on Android 7+ devices (Oreo tested on emu). The application was loading properly before. Logcat follows:

Xwalk crash

In the app code the crash seems to originate from the following line: XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);, which is in the class extending Application, which in turn holds just Debug/Release configuration for the tools used. Removing said line allows the application to work properly until the point it actually tries to load the XWalkView.

The app is running properly on Android 4.4 (19 min SDK for app), 5.0 (21) and 6.0 (23).

I have been scouring the internet for a possible solution but haven't found something that helped yet. I know that crosswalk is Deprecated and should probably be replaced but WebGL support is not a given in Android and I don't see the current graphics getting changed at this time.

If there is any other info that might be helpful let me know and I will provide it.

Hope someone can shed some light. Thanks in advance.

EDIT:

After some playing around, I discovered that the issue is with the library file. Downloading the crosswalk.aar I found that there are 2 versions of it:

  • xwalk_core_library-23.53.589.4-arm.aar
  • xwalk_core_library-23.53.589.4-arm64.aar

I removed the maven version and manually included the files. When I use the arm64 bit I can actually use the application without any problems in the Android 7 platform. But then I get the same xwalk crash in the other versions. In case of the arm library, things go back to how they were before.

Together they cannot work. You get the Duplicate zip file error when building.

So the renewed question is: Is there a way to tell to gradle which library file to use per architecture? I have been looking around but I cannot find something.


Solution

  • I managed to resolve the issue. It was a compatibility issue with the library's included JNIs.

    The maven loaded library was only including armeabi-v7a and x86 ".so" files.

    What I did was to manually download the general and arm64 aar versions of the library from here, unzip them, move the arm64-v8a jni folder contents over to the other side and then use jar cvf [yourLibName].aar -C [folderName]/ . (don't forget the dot at the end) command to repackage the aar.

    Everything seems to be working fine for now. Hopefully Oreo will be OK too, once I manage to test on a device.