Make sure a gradle dependency includes 32bit and 64bit libraries in app bundles

1.3k Views Asked by At

I want to use the xwalk library to embed a chromium webview in the app. This is done via a gradle dependency.

implementation 'org.xwalk:xwalk_core_library:23.53.589.4'

This dependency is an .aar file which is available in a 32bit and 64bit version. However, only the 32bit version is actually embedded in the build.

By checking the created app bundle, only the lib/x86 and lib/armeabi-v7a versions are embedded.

When checking the available versions on the maven repository for that version - see https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/23.53.589.4/ - one can see that there are of course versions for all cpu architectures available:

  • xwalk_core_library-23.53.589.4-64bit.aar
  • xwalk_core_library-23.53.589.4-arm.aar
  • xwalk_core_library-23.53.589.4-arm64.aar
  • xwalk_core_library-23.53.589.4-x86.aar
  • xwalk_core_library-23.53.589.4-x86_64.aar
  • xwalk_core_library-23.53.589.4.aar

I assume that by specifying the dependency the way i did, the last one will be embedded in the app. I downloaded the aar and checked the content and as assumed, only the x86 and arm(32) libs are included. I don't know if this is supposed to be that way or if this is a deployment issue.

Anyway, I tried to include 32bit and 64bit dependencies manually by adding the specific gradle classifiers, but because in the aar there are also java classes included, I ended up having build errors because of duplicate classes.

Is there any way to solve that the proper gradle way?

1

There are 1 best solutions below

2
On

I have faced the same issue a few days ago with xwalk_core_library. What I had done:

  1. Download the .aar file from the URL
  2. Add it into the libs folder

in app/build.gradle

For 32bit

dependencies{
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    debugImplementation files('libs/xwalk_core_library-23.53.589.4.aar')
    releaseImplementation files('libs/xwalk_core_library-23.53.589.4.aar')
}

For 64bit

dependencies{
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    debugImplementation files('libs/xwalk_core_library-23.53.589.4-64bit.aar')
    releaseImplementation files('libs/xwalk_core_library-23.53.589.4-64bit.aar')
}

And make separate build for 32-bit and 64-bit version. Make sure to include appropriate .aar files before making build.

Android PlayStore provides Multiple APK support. So you can upload multiple APKs at the same time. Also, don't forget to upgrade versionCode for 32-bit and 64-bit version.