Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error trying to instantiate TestSupportFragmentActivity #13

Open
mtotschnig opened this issue Aug 10, 2022 · 2 comments · May be fixed by #16
Open

Cryptic error trying to instantiate TestSupportFragmentActivity #13

mtotschnig opened this issue Aug 10, 2022 · 2 comments · May be fixed by #16

Comments

@mtotschnig
Copy link

Basic Information

Device type: GIONEE S10L
OS version: Android 9
EasyPermissions version: 1.0.0

Describe the problem

I have got one crash report from crashlytics with the following stacktrace.

Fatal Exception: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.totschnig.myexpenses/com.vmadalin.easypermissions.components.TestSupportFragmentActivity}: java.lang.ClassNotFoundException: Didn't find class "com.vmadalin.easypermissions.components.TestSupportFragmentActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.totschnig.myexpenses-Wq04CPgZmNJUUtoxLQjTGg==/base.apk"],nativeLibraryDirectories=[/data/app/org.totschnig.myexpenses-Wq04CPgZmNJUUtoxLQjTGg==/lib/arm64, /system/lib64]]
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2881)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6718)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by java.lang.ClassNotFoundException: Didn't find class "com.vmadalin.easypermissions.components.TestSupportFragmentActivity" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.totschnig.myexpenses-Wq04CPgZmNJUUtoxLQjTGg==/base.apk"],nativeLibraryDirectories=[/data/app/org.totschnig.myexpenses-Wq04CPgZmNJUUtoxLQjTGg==/lib/arm64, /system/lib64]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
       at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
       at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
       at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6718)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

I have no idea if the user uses some tool that inspects the APK and does some weird stuff with it, or if this is a legit use of my app and the OS screws up.
In any case, it might be safer to move the references to test activities out of the main AndroidManifest into the test source set.

@dabarnard
Copy link

I have started seeing similar crashes on Android 8.1 devices in an app of mine. Also version 1.0.0 of the library.

@mtotschnig did you manage to find the cause of this?

@mtotschnig
Copy link
Author

@dabarnard The crash is quite easy to reproduce. From adb call (with your application_id)
adb shell am start -n "{application_id}/com.vmadalin.easypermissions.components.TestSupportFragmentActivity"
The cause is that references to this activity along with two others that exist only for tests, are erroneously added to the AndroidManifest that gets merged into your production APK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants