Julio Garcia Julio Garcia - 25 days ago 8
Android Question

Force Android Studio to compile ARM64 versions of external libraries

I am trying to embed CrossWalk on native android using the method explained here:
embed crosswalk in android studio

The problem that I am having is that android studio is not building the needed libraries for ARM64, even though those libraries are on the Maven repository.

Here is my build.gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "my.app.id"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
flatDir{
dirs 'libs'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'org.xwalk:xwalk_core_library:22.52.561.4'
compile (name: 'wikitudesdk', ext:'aar')
testCompile 'junit:junit:4.12'
}


Is there a way to tell android studio expicitly to compile those libraries?

Answer

OK I finally found the solution here: diego.org

Basically if you need the ARM64 library you first need to download the correct library yourself:

curl -O https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/22.52.561.4/xwalk_core_library-22.52.561.4-arm64.aar

Then install it to the local maven repository:

mvn install:install-file -DgroupId=org.xwalk -DartifactId=xwalk_core_library \
  -Dversion=22.52.561.4-arm64 -Dpackaging=aar  \
  -Dfile=xwalk_core_library-22.52.561.4-arm64.aar \
  -DgeneratePom=true

And update you build gradle so that the repositories point to you local maven repo:

repositories {
    mavenLocal()
}

and you compile the correct lib:

compile 'org.xwalk:xwalk_core_library:22.52.561.4-arm64'

Hope it helps someone as future reference.