I have a tricky problem with Android builds. The framework I use is React Native 0.61.5.
I have to use a particular SDK which needs to use a library called libj2v8utils.so. After some deepening I noticed that this library should be accompanied with another one: libj2v8.so.
The libj2v8.so library is always present in the <root>/android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a
path (all architectures), while the libj2v8utils.so library is present only for the arm64-v8a
architecture.
Unfortunately I am not an expert in the Android environment and what concerns the project configurations with Maven, build.gradle and so on. However, I have made a few attempts like the following:
packagingOptions {
pickFirst '**/*.so'
}
or
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jnilibs']
}
}
All without success.
The details of the error are as follows:
java.lang.NoClassDefFoundError: com.my.custom.sdk.common.internal.core.utils.J2V8Utils
...
can't get JS engine attributes
MyCustomSDK: Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/my.bundle123==/base.apk"],nativeLibraryDirectories=[/data/app/my.bundle123==/lib/arm, /data/app/my.bundle123==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]] couldn't find "libj2v8utils.so"
Finally, in the application logs I see:
authentication failed Internal error occurred (TypeError: t.getData is not a function)
The following screenshots show the libraries generated for the different architectures:
When I build the APK by npx react-native run-android
I don't notice anything in particular. How can I solve this issue?
question from:
https://stackoverflow.com/questions/65904443/react-native-android-couldnt-find-libj2v8utils-so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…