VTR2015
VTR2015

Reputation: 439

Renderscript via Gradle crashs Vuforia

I have a problem that affects some android devices and do not know how to solve.

These devices that are tested presenting this error

System.err: The library libVuforia.so could not be loaded.

Nexus 6p (Android 7), Galaxy S5 (Android 6.0.1), Galaxy S7 (Android 6), Xiaomi Redmi 2 (Android 4.4.4), Galaxy S6 (Android 6.0.1)

This error is occurred when i configured in Gradle is setting:

defaultConfig {

           applicationId "com.app.myapp"

           minSdkVersion 16

           targetSdkVersion 24

           versionCode 1

           versionName "1.0"

           renderscriptTargetApi 24

           renderscriptSupportModeEnabled true

}

The strangest thing that only happens on some devices. I know Vuforia is compiled into armeabi-v7a and it is running for example in Moto X Play but other devices presents the reported problem.

Upvotes: 0

Views: 104

Answers (1)

Miao Wang
Miao Wang

Reputation: 1130

I guess the problem is that when renderscriptSupportModeEnabled set to "true", gradle tries to copy RenderScript related libraries of different architectures: armeabi-v7a, arm64, etc to the apk, while libvuforia only has armeabi-v7a variant (no 64-bit).

When the apk gets installed on arm64 devices, it will be installed as a 64-bit application, and thus only RenderScript libraries are extracted, and causing the issue "libvuforia not found".

The workaround is to config gradle with split apk settings to include only armeabi-v7a libs: https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split, which will force the package manager install it as 32-bit.

Upvotes: 1

Related Questions