Android Question B4A 14.20 Beta - Google Play Billing error

Jerryk

Active Member
Licensed User
Longtime User
I copied these files to the internal library.
It's interesting that GooglePlayBilling shows version 8.1 in the Library Manager, while the online version shows 8.0.

when compiling with #R8Optimizer: True, on the line...
B4X:
'builds a BillingResult so that every code path can return a real result object
Private Sub BuildBillingResult (ResponseCode As Int, DebugMessage As String) As BillingResult
    Dim Builder As JavaObject
    Builder = Builder.InitializeStatic("com.android.billingclient.api.BillingResult").RunMethod("newBuilder", Null)
    Builder.RunMethod("setResponseCode", Array(ResponseCode))  <---- error
    Builder.RunMethod("setDebugMessage", Array(DebugMessage))
    Return Builder.RunMethod("build", Null)
End Sub
I got this error:
B4X:
java.lang.RuntimeException: Method: setResponseCode not found in: com.android.billingclient.api.g
    at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(SourceFile:186)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(SourceFile:11)
    at gpb.example.gpbilling_je._buildbillingresult(SourceFile:95)
    at gpb.example.gpbilling_je$ResumableSub_AcknowledgeProducts.resume(SourceFile:208)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(SourceFile:10)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(SourceFile:115)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(SourceFile:496)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(SourceFile:12)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(SourceFile:264)
    at anywheresoftware.b4a.BA.raiseEvent(SourceFile:7)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(SourceFile:42)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(SourceFile:45)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(SourceFile:227)
    at anywheresoftware.b4a.BA$2.run(SourceFile:129)
    at android.os.Handler.handleCallback(Handler.java:995)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loopOnce(Looper.java:248)
    at android.os.Looper.loop(Looper.java:338)
    at android.app.ActivityThread.main(ActivityThread.java:9067)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)
** Activity (main) Pause event (activity is not paused). **
 
Last edited:
Solution
Resolved by adding these lines to GooglePlayBilling.proguard.

-keep class com.android.billingclient.api.BillingResult { *; }
-keep class com.android.billingclient.api.BillingResult$Builder { *; }
Top