guardianproject / orbot

The Github home of Orbot: Tor on Android (Also available on gitlab!)
https://gitlab.com/guardianproject/orbot
Other
1.98k stars 325 forks source link

[BUG] Selecting Ask Tor causes Fatal exception #1073

Closed syphyr closed 3 months ago

syphyr commented 3 months ago

Describe the Bug Orbot crashes with fatal exception when selecting "Ask Tor"

To Reproduce Steps to reproduce the behavior:

  1. Go to Choose How to Connect
  2. Click on Ask Tor
  3. Orbot crashes
  4. See error

Expected Behavior Orbot should not crash

What Custom Configuration Do You Use? If applicable, how did you set up Orbot? Did you configure some settings?

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Crash Logs (Advanced)

01-27 20:43:45.367  6691  6691 E AndroidRuntime: FATAL EXCEPTION: main
01-27 20:43:45.367  6691  6691 E AndroidRuntime: Process: org.torproject.android, PID: 6691
01-27 20:43:45.367  6691  6691 E AndroidRuntime: java.lang.IllegalArgumentException: Unable to create call adapter for interface retrofit2.Call
01-27 20:43:45.367  6691  6691 E AndroidRuntime:     for method CircumventionEndpoints.getSettings
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.Utils.methodError(SourceFile:0)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.HttpServiceMethod.createCallAdapter(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.HttpServiceMethod.parseAnnotations(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.ServiceMethod.parseAnnotations(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.Retrofit.loadServiceMethod(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.Retrofit$1.invoke(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at java.lang.reflect.Proxy.invoke(Proxy.java:813)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at $Proxy1.getSettings(Unknown Source)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at org.torproject.android.circumvention.CircumventionApiManager.getSettings(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at org.torproject.android.ConfigConnectionBottomSheet.askTor(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at org.torproject.android.ConfigConnectionBottomSheet.onCreateView$lambda-0(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at org.torproject.android.ConfigConnectionBottomSheet.$r8$lambda$VjE8Knr6rf3y18D94IrjoMhyVUM(SourceFile:0)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at org.torproject.android.ConfigConnectionBottomSheet$$ExternalSyntheticLambda1.onClick(SourceFile:0)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.view.View.performClick(View.java:5637)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.view.View$PerformClick.run(View.java:22433)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:751)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6186)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
01-27 20:43:45.367  6691  6691 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Call return type must be parameterized as Call<Foo> or Call<? extends Foo>
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.DefaultCallAdapterFactory.get(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.Retrofit.nextCallAdapter(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    at retrofit2.Retrofit.callAdapter(SourceFile)
01-27 20:43:45.367  6691  6691 E AndroidRuntime:    ... 21 more

Additional Context Add any other context about the problem here.

bitmold commented 3 months ago

I'm not able to reproduce this at all based off of a fresh clone + install of the main branch... Do you have r8/minify stuff turned on? I am gonna return to this tomorrow but I wonder if tht:

I found out it was crashing because of Proguard/R8. Proguard was renaming Retrofit classes and to fix it I updated the Proguard settings with. I'm seeing something similar here: https://stackoverflow.com/questions/62464914/unable-to-create-call-adapter-for-retrofit2-response

-dontwarn retrofit2.**
-keep class retrofit2.** { *; }

That r8 minify branch I put up is still a work in progress, but ya I reckon if you have #1063 type changes on your machine then that breaks the retrofit2 stuff that Orbot uses to talk to the Tor Project here...

syphyr commented 3 months ago

Oh, thanks for finding that. Yes, I did have your minify changes added.

syphyr commented 3 months ago

I will close this because this bug was introduced by minify. Although, adding the proguard rules you mentioned above did not solve the issue. I will comment further on this on the minify PR.