Android Question #R8 and B4XLib crashing method not found in: okhttp3.Request$Builder

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Getting this error with #R8 - java.lang.RuntimeException: Method: method not found in: okhttp3.Request$Builder

I have added these lines to my B4XLib manifest but still not fixing problem

Code: Copy
AddProguardText(
    -keep class com.simplysoftware.base64convert.base64convert {*;}
    -keep class okhttp3.OkHttpClient { *; }
    -keep class okhttp3.Dispatcher { *; }
    -keep class okhttp3.internal.connection.RealCall$CallReference { *; }
    -keep class okhttp3.internal.connection.RealCall { *; }
    -keep class okhttp3.Request { *; }
)
 
changed my Proguard text to

AddProguardText(
-keep class com.simplysoftware.base64convert.base64convert {*;}
-keep class okhttp3.OkHttpClient { *; }
-keep class okhttp3.Dispatcher { *; }
-keep class okhttp3.internal.connection.RealCall$CallReference { *; }
-keep class okhttp3.internal.connection.RealCall { *; }
-keep class okhttp3.Request$Builder { *; }
-keep class okhttp3.Request { *; }
)

Added Request$Builder and that fixed the problem.

NOT sure if order matters (originally I have Request$Builder after Request and it still failed) - will investigate
 
Upvote 0
I guess that, in the long run, these rules will be included in the okhttp library in a future update.
or should I begin to collect all the rules I see in the forum and add them to all my manifests?
 
Upvote 0
The answer is - no, you shouldn't collect those rules.

Libraries should include all needed rules. If you are adding inline Java code or doing some complex JavaObject calls then you might need to manually add rules. As this is a new feature, not all missing rules were discovered so there might be some friction. It will improve as more issues are reported.
 
Upvote 0
Back
Top