NoSuchMethodError on unobfuscated APK
See original GitHub issueDetails And Error Currently our Automation team uses Appium with UIAutomator2 but we are looking to make the switch to the espresso-driver to help with testing Android Recyclerviews.
On our tests that worked on the UIAutomator2 we are now seeing this error using the espresso-driver:
Proxying [POST /session] to [POST http://localhost:8200/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","app":"/Users/rockwig/Downloads/app-debug.apk","autoGrantPermissions":true,"automationName":"espresso","deviceName":"emulator-5554","newCommandTimeout":10000,"resetKeyboard":true,"systemPort":8200,"unicodeKeyboard":true},"platformName":"android","app":"/Users/rockwig/Downloads/app-debug.apk","autoGrantPermissions":true,"automationName":"espresso","deviceName":"emulator-5554","newCommandTimeout":10000,"resetKeyboard":true,"systemPort":8200,"unicodeKeyboard":true,"deviceUDID":"emulator-5554","appPackage":"com.ourfamilywizard","appWaitPackage":"com.ourfamilywizard","appActivity":"com.ourfamilywizard.login.activity.LoginActivity","appWaitActivity":"com.ourfamilywizard.login.activity.LoginActivity"}],"alwaysMatch":{}}}
[debug] [Espresso] [Instrumentation] Process crashed while executing startEspressoServer(io.appium.espressoserver.EspressoServerRunnerTest):
[debug] [Espresso] java.lang.NoSuchMethodError: No direct method <init>(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/PropertyReference1Impl; or its super classes (declaration of 'kotlin.jvm.internal.PropertyReference1Impl' appears in /data/app/~~D3o6gWwUAGVZL4YA0w1cHQ==/io.appium.espressoserver.test-ELPxSt8tB_Ojzmg9MoOxlw==/base.apk)
[debug] [Espresso] at com.ourfamilywizard.login.activity.LoginActivity.<clinit>(Unknown Source:12)
[debug] [Espresso] at java.lang.Class.newInstance(Native Method)
[debug] [Espresso] at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
[debug] [Espresso] at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
[debug] [Espresso] at android.app.Instrumentation.newActivity(Instrumentation.java:1253)
[debug] [Espresso] at androidx.test.runner.MonitoringInstrumentation.newActivity(MonitoringInstrumentation.java:798)
[debug] [Espresso] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3353)
[debug] [Espresso] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
[debug] [Espresso] at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
[debug] [Espresso] at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
[debug] [Espresso] at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
[debug] [Espresso] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
[debug] [Espresso] at android.os.Handler.dispatchMessage(Handler.java:106)
[debug] [Espresso] at android.os.Looper.loop(Looper.java:223)
[debug] [Espresso] at android.app.ActivityThread.main(ActivityThread.java:7656)
[debug] [Espresso] at java.lang.reflect.Method.invoke(Native Method)
[debug] [Espresso] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
[debug] [Espresso] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Background/ What we already tried: We did see this previous issue here and tried running our test on our debug APK which we do not add obfuscation to but still got the same error. So this leads us to think that this issue is not related to Proguard.
Our app does have a fragment on the initial launch of the Login Activity and uses the Jetpack Navigation Library, if that helps.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Android, Proguard & XmlPullParser: NoSuchMethodError
Most crashes happen because Proguard has obfuscated away something that your application needs, such as a class that is referenced in the ...
Read more >Error while starting instrumentation with Obfuscated apk (with ...
When the app is obfuscated, Its complains NoSuchMethodError for obfuscated ... If I build unobfuscated app, I do not get above error.
Read more >NoSuchMethodError after applying ProGuard in Android APK
NoSuchMethodError : No virtual method a(Ljava/lang/Object;)Ljava/lang/StringBuilder; in class Ljava/lang/StringBuilder; or its super classes ...
Read more >Java Obfuscator - Zelix KlassMaster™ - FAQ
Zelix KlassMaster™ supports Google Android™ by obfuscating the Java class files before they are ... "Can't find class Classname" or "NoSuchMethodError" are:.
Read more >NoSuchMethodError - Android Developers
android.app.appsearch.observer. Overview. Interfaces. ObserverCallback. Classes. DocumentChangeInfo · ObserverSpec · ObserverSpec.Builder · SchemaChangeInfo.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the information. I see. DI libraries cause such configuration issues.
I used Kotlin version
1.4.32
on our test and we did use the same versions forkotlin-reflect
andkotlin-stdlib
. But I’m starting to think this error is because of our Dagger dependency injection setup in the Android app itself. Dependency Injection hasn’t been set up for tests. When we try to run a simple Espresso test locally (not using Appium) we get the same error, but more information on why-