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

Error while starting instrumentation with Obfuscated apk (with proguard) #232

Open
rajdeepv opened this issue Sep 25, 2018 · 6 comments
Open
Labels

Comments

@rajdeepv
Copy link
Collaborator

Details
Espresso server has gson as dependancy. In many cases gson is a dependancy of the app under test as well. When the app is obfuscated, Its complains NoSuchMethodError for obfuscated methods as below:

09-25 13:45:02.818  9721  9721 E MonitoringInstr: java.lang.NoSuchMethodError: No static method d(Ljava/lang/reflect/Type;)Ljava/lang/reflect/Type; in class Lcom/google/gson/internal/$Gson$Types; or its super classes (declaration of 'com.google.gson.internal.$Gson$Types' appears in /data/app/io.appium.espressoserver.test-1/base.apk)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.google.gson.b.a.<init>(TypeToken.java:72)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.google.gson.b.a.b(TypeToken.java:303)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.google.gson.e.<clinit>(Gson.java:112)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.google.gson.f.b(GsonBuilder.java:572)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.badoo.mobile.eventbus.a.c.<clinit>(EventLoggerImpl.java:29)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.badoo.mobile.eventbus.a.b.a(EventLoggerFactory.java:12)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.bumble.app.application.BumbleApplicationLogic.onPreCreate(BumbleApplicationLogic.java:73)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.bumble.app.application.BumbleDebugApplicationLogic.onPreCreate(BumbleDebugApplicationLogic.java:53)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.badoo.mobile.b.c.onCreate(BadooBaseApplication.java:85)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.supernova.app.application.d.onCreate(NextGenApplication.kt:25)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.bumble.app.application.BumbleDebugApplication.onCreate(BumbleDebugApplication.kt:23)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.support.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:382)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.app.ActivityThread.-wrap3(ActivityThread.java)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.os.Handler.dispatchMessage(Handler.java:102)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.os.Looper.loop(Looper.java:154)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at android.app.ActivityThread.main(ActivityThread.java:6682)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at java.lang.reflect.Method.invoke(Native Method)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
09-25 13:45:02.818  9721  9721 E MonitoringInstr: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
@dpgraham
Copy link
Contributor

So the app gets obfuscated but espresso-server doesn't, and that still happens?

@rajdeepv
Copy link
Collaborator Author

Yes, App under test is obfuscated but Espresso server is not.
If I build unobfuscated app, I do not get above error.

@dpgraham dpgraham added the bug label Oct 16, 2018
@dpgraham
Copy link
Contributor

I'm going to look at this.... @mykola-mokhnach do you have any ideas, off the top of your head, why this would be happening?

@rajdeepv
Copy link
Collaborator Author

@dpgraham I have found a way to avoid this. In the application code, we need to make sure that we don't obfuscate com.google.gson

Thanks!

@dpgraham
Copy link
Contributor

Okay good to know @rajdeepv! We'll still keep it open though. For other users who have this same problem we'll need to either come up with a solution or list it as a "Known Issue" and provide a recommended workaround.

@KazuCocoa
Copy link
Member

Maybe, this is also a similar issue. I would leave the log here.

05-08 10:01:18.336 E/AndroidRuntime(24598): java.lang.NoSuchMethodError: No direct method <init>(Lkotlin/reflect/d;Ljava/lang/String;Ljava/lang/String;)V in class Lkotlin/jvm/internal/PropertyReference1Impl; or its super classes (declaration of 'kotlin.jvm.internal.PropertyReference1Impl' appears in /data/app/io.appium.espressoserver.test-JDAO30jOyu-UyGfxC1cicw==/base.apk)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.debugoptions.a.<clinit>(Unknown Source:15)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.eventtracking.a.b.a(EventsNetworkModule_ProvideHttpLoggingInterceptorFactory.java:1047)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at dagger.internal.b.a(DoubleCheck.java:47)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.eventtracking.a.d.a(EventsNetworkModule_ProvideOkHttpClientFactory.java:1056)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at dagger.internal.b.a(DoubleCheck.java:47)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.eventtracking.a.h.a(EventsTrackingModule_ProvidesEventsFactory.java:1029)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at dagger.internal.b.a(DoubleCheck.java:47)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.eventtracking.a.g.a(EventsTrackingModule_ProvideEventServiceFactory.java:1024)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at dagger.internal.b.a(DoubleCheck.java:47)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.h.g$c.a(DaggerApplicationComponent.java:1155)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.App.f(App.java:181)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.App.c(App.java:165)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.aspiro.wamp.App.onCreate(App.java:7161)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:413)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5822)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.app.ActivityThread.-wrap1(Unknown Source:0)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.os.Handler.dispatchMessage(Handler.java:105)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.os.Looper.loop(Looper.java:251)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at android.app.ActivityThread.main(ActivityThread.java:6572)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at java.lang.reflect.Method.invoke(Native Method)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
05-08 10:01:18.336 E/AndroidRuntime(24598):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

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

No branches or pull requests

3 participants