PPP
PPP

Reputation: 1870

Android app error: Kotlin class not found but only on Release apk

I'm having a very strange bug that only happens on Release. If I install the app in Debug mode through Android Studio, everything works fine. If I change the bild variant to Release, I get this error right on the startup of the app:

2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: Build fingerprint: 'motorola/griffin/griffin:8.0.0/OPL27.76-71-2-3/3:user/release-keys'
2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: Revision: 'p3b0'
2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: ABI: 'arm64'
2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: pid: 19179, tid: 19179, name: om.stompai.kick  >>> com.stompai.kick <<<
2020-06-02 20:53:14.892 19248-19248/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG: Abort message: 'thread.cc:2036] No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.mobileer.androidfxlab.datatype.EffectDescription" on path: DexPathList[[zip file "/data/app/com.stompai.kick-2yS5YP_5sv5B-eZMR3oZbA==/base.apk"],nativeLibraryDirectories=[/data/app/com.stompai.kick-2yS5YP_5sv5B-eZMR3oZbA==/lib/arm64, /data/app/com.stompai.kick-2yS5YP_5sv5B-eZMR3oZbA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]'
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x0   0000000000000000  x1   0000000000004aeb  x2   0000000000000006  x3   0000000000000008
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x4   0000000000000000  x5   0000000000000000  x6   0000000000000000  x7   0080808080808080
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x8   0000000000000083  x9   f6d5a51ab7c22c2d  x10  0000000000000000  x11  0000000000000001
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x12  ffffffffffffffff  x13  0000000000000008  x14  ffffffffffffffff  x15  000017b556277360
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x16  0000007f881e12f8  x17  0000007f881829d4  x18  0000000000000020  x19  0000000000004aeb
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x20  0000000000004aeb  x21  0000007f77dc0800  x22  0000000000000058  x23  000000000000095c
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x24  0000000000000061  x25  0000007f6c157600  x26  000000000000095b  x27  0000000000000059
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     x28  0000007fd10538a1  x29  0000007fd10535a0  x30  0000007f88136d24
2020-06-02 20:53:14.893 19248-19248/? A/DEBUG:     sp   0000007fd1053560  pc   0000007f881829dc  pstate 0000000060000000
2020-06-02 20:53:14.898 19248-19248/? A/DEBUG: backtrace:
2020-06-02 20:53:14.898 19248-19248/? A/DEBUG:     #00 pc 00000000000699dc  /system/lib64/libc.so (tgkill+8)
2020-06-02 20:53:14.898 19248-19248/? A/DEBUG:     #01 pc 000000000001dd20  /system/lib64/libc.so (abort+88)
2020-06-02 20:53:14.898 19248-19248/? A/DEBUG:     #02 pc 0000000000437c9c  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+528)
2020-06-02 20:53:14.898 19248-19248/? A/DEBUG:     #03 pc 00000000004383ac  /system/lib64/libart.so (_ZN3art7Runtime7AborterEPKc+24)
2020-06-02 20:53:14.899 19248-19248/? A/DEBUG:     #04 pc 0000000000522ab4  /system/lib64/libart.so (_ZN7android4base10LogMessageD1Ev+900)
2020-06-02 20:53:14.899 19248-19248/? A/DEBUG:     #05 pc 0000000000462858  /system/lib64/libart.so (_ZNK3art6Thread24AssertNoPendingExceptionEv+1144)
2020-06-02 20:53:14.902 19248-19248/? A/DEBUG:     #06 pc 0000000000127dac  /system/lib64/libart.so (_ZN3art11ClassLinker9FindClassEPNS_6ThreadEPKcNS_6HandleINS_6mirror11ClassLoaderEEE+64)
2020-06-02 20:53:14.903 19248-19248/? A/DEBUG:     #07 pc 0000000000311ec4  /system/lib64/libart.so (_ZN3art3JNI9FindClassEP7_JNIEnvPKc+1432)
2020-06-02 20:53:14.903 19248-19248/? A/DEBUG:     #08 pc 0000000000068698  /data/app/com.stompai.kick-2yS5YP_5sv5B-eZMR3oZbA==/lib/arm64/libfxlib.so (Java_com_mobileer_androidfxlab_NativeInterface_getEffects+88)
2020-06-02 20:53:14.903 19248-19248/? A/DEBUG:     #09 pc 000000000004590c  /data/app/com.stompai.kick-2yS5YP_5sv5B-eZMR3oZbA==/oat/arm64/base.odex (offset 0x2c000)

As you see, the error is

java.lang.ClassNotFoundException: Didn't find class "com.mobileer.androidfxlab.datatype.EffectDescription

This is a simply class located at

java/com/github/mobileer/androidfxlab/datatype/EffectDescription

I thought it had something to do with this being a Kotlin class located inside the /java folder so I moved it to /kotlin/com/mobileer/androidfxlab/... but the same error continues.

I have no clue on this problem. I tried cleaning an rebuilding the project, and also a friend of mine had the same problem on his computer, so this does not look like a build bug.

Upvotes: 1

Views: 1159

Answers (1)

Alan Deep
Alan Deep

Reputation: 2105

This seems to be a Proguard problem.

Solution 1:

If you want to keep proguard activated,

add the below to proguard-rules.pro file

-keep class com.mobileer.** { *; }

otherwise, if you don't want proguard activated

Solution 2:

set minifyEnabled false in build.gradle

Upvotes: 4

Related Questions