React-Native + Android, armeabi only

NOTE. These libraries are provided to me, I cannot create others for other architectures.

I am currently porting an Android app that responds to-native, which uses its own libraries, but I only have armeabi available. There is no problem with the original project so far, since armeabi is supported by all x86 / x86_64 / armeabi-v7a / arm64-v8a devices .

Then, when I create a new project from native-native and include these armeabi files, some libraries are not found when apk starts. When I unzip the apk generated by the original project, I can find the folder: lib / armeabi with all the libraries, so there is no problem. Now, when I unzip my apk created by response-native, I have 2 folders: lib / armeabi-v7a and lib / x86, and some libraries are missing.

Here is my gradle configuration with a-native response:

apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false android { compileSdkVersion 23 buildToolsVersion '23.0.3' defaultConfig { applicationId "com.poc" minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName "1.0" ndk { abiFilters "armeabi-v7a", "x86" } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } veryVerbose { } } signingConfigs { releaseConfig { } buildTypes { release { debuggable true jniDebuggable false signingConfig signingConfigs.releaseConfig } } } // applicationVariants are eg debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a":1, "x86":2] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) // Player library veryVerboseCompile fileTree(dir: 'veryVerboseLibs', include: ['*.jar']) debugCompile fileTree(dir: 'releaseLibs', include: ['*.jar']) releaseCompile fileTree(dir: 'releaseLibs', include: ['*.jar']) // Google compile "com.android.support:appcompat-v7:23.0.1" // Square compile 'com.jakewharton:butterknife:8.2.1' apt 'com.jakewharton:butterknife-compiler:8.2.1' // From node_modules compile "com.facebook.react:react-native:+" } 

It seems that with the help of the auto-generate command some configuration relative to the architecture, a little new for me, I would need to tell gradle to build for armeabi and include all these libraries in the lib / armeabi folder in my last apk.

And basically what I get from logcat and running apk:

 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.siminntvpoc-2/base.apk"],nativeLibraryDirectories=[/data/app/com.siminntvpoc-2/lib/x86, /data/app/com.siminntvpoc-2/base.apk!/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libViewRightWebClient.so" 
+6
source share
2 answers

You must specify which architecture you want in application.mk .

To support the entire architecture, use this attribute APP_ABI := all in the application.mk file

here is the document https://developer.android.com/ndk/guides/application_mk.html

+3
source

if you are using experimental gradle build

add this to build.gradle

 abiFilters.addAll([ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ]) 

yet

 APP_ABI:=all in Application.mk 

More details

+1
source

All Articles