Fixed crash in native code
· 3 min read
We have released new patch versions 3.14.8, 3.15.6, 3.16.8, 3.17.12, and 3.18.19 for our Android SDK.
Patch overview
Added fix in the native code to support no Java package name in the Activity or Application.
- This avoids affected Encap SDKs having a crash in the native code
libencap-android-api.soupon startup of the app, following obfuscation with version 8 or higher of the Android Gradle Plugin. For example:signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0Cause: null pointer dereferencex0 0000000000000000 x1 000000000000002e x2 00000000000003fe x3 0000007fc4ac5408x4 0000000000000003 x5 0000000000000004 x6 0000000000008048 x7 24ff3a6d6e687360x8 0000000000000000 x9 0000000000000000 x10 0000007315aa8000 x11 0000000000000020x12 0000000000000009 x13 00000000d047da0c x14 0000000000000069 x15 000000000000006fx16 00000072d93d83c8 x17 00000075a03c5244 x18 00000075b3f4a000 x19 b4000073b5aa6f50x20 00000075b4c8e08d x21 b400007315ab56f0 x22 00000075b39ae000 x23 b400007345ad04e0x24 0000007fc4ac6638 x25 00000072d93d6374 x26 b400007375acd6d0 x27 00000075b39ae000x28 b4000073b5aa6f50 x29 0000007fc4ac6450lr 00000072d93d4ef0 sp 0000007fc4ac5440 pc 00000072d93d4ef0 pst 0000000080000000backtrace:#00 pc 0000000000002ef0 /data/app/~~AFEop-SVX63wreyZzeYp7A==/com.encapsecurity.encap.example.android.testapp-NJtFrXRjua6YVkum0fgwcQ==/base.apk!libencap-android-native-api.so (BuildId: 59ea07c78f55678b6e364a2f67ea8bc42190f7eb)#01 pc 00000000000043c4 /data/app/~~AFEop-SVX63wreyZzeYp7A==/com.encapsecurity.encap.example.android.testapp-NJtFrXRjua6YVkum0fgwcQ==/base.apk!libencap-android-native-api.so (JNI_OnLoad+80) (BuildId: 59ea07c78f55678b6e364a2f67ea8bc42190f7eb)#02 pc 000000000051c1a8 /apex/com.android.art/lib64/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, _jclass*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1872) (BuildId: 02bec5940be704b863f6514fc7d81c41)#03 pc 00000000000051c0 /apex/com.android.art/lib64/libopenjdkjvm.so (JVM_NativeLoad+412) (BuildId: e2d871bce04eabb6198cc5c94b2b4059)#04 pc 000000000036095c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+156) - This is because the native code
libencap-android-api.soexpects a Java package name in the Activity or Application, but obfuscation removes the Java package name. - You can observe this bug with R8 obfuscation in the Android Gradle Plugin 8.
Affected versions
If your app uses an affected version of the SDK, then you should upgrade it to use the latest, patched version:
| Affected versions | Patched version |
|---|---|
| 3.14.6 | 3.14.8 |
| 3.15.4 | 3.15.6 |
| 3.16.6 | 3.16.8 |
| 3.17.7 | 3.17.12 |
| 3.18.7 | 3.18.19 |
| Earlier versions | N/A |
How to upgrade
For the latest features and security improvements, you need to upgrade your mobile app to use the most recent version of the SDK.
To learn how to do this, see our Upgrade guide.
Alternative to upgrading
For alternatives to upgrading, see the Alternative workarounds section below.
Alternative workarounds
Alternatively, you can also implement one of the following workarounds to solve the issue:
- This bug can be avoided by adding a Proguard rule for the app:
-repackageclasses 'com.mypackagename'
- This bug can be avoided by disabling R8 full mode in
gradle.properties:android.enableR8.fullMode=false