question

Ta-Dah Apps avatar image
Ta-Dah Apps asked ·

In-App billing not working since Android Studio defaulted to R8 tool.

The latest release of Android Studio, version 3.4 uses the R8 component in the app build process by default. Having built our app with this new tool chain I find that In-App purchases no longer work. We get a FAILED response in onPurchaseResponse. By disabling R8, in-app purchases again work. We would prefer to use the latest tool chain in our builds and disabling R8 is not an acceptable long term solution. R8 does replace the Proguard obfuscation tool so this could be part of the problem.

iapandroid
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

CyberDream avatar image
CyberDream answered ·

This is a bad pitfall which took my some hours to fix. Why isn't this fixed or at least a FAQ entry be Amazon or check? IAP was working locally. Disabling R8 fixed it hopefully.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-f02686e2-28a8-4e0c-a9fa-6f08835a44e6 avatar image
newuser-f02686e2-28a8-4e0c-a9fa-6f08835a44e6 answered ·

Disabling R8 helped

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-15c80a7c-cfaa-4dc5-90f2-2bffcaf3ef4e avatar image
newuser-15c80a7c-cfaa-4dc5-90f2-2bffcaf3ef4e answered ·

See https://issuetracker.google.com/issues/134766810


The problem is known, Amazon team has been invited to solve it but doesn't do anything. Even the IAP documentation is wrong, claiming that IAP works with R8 (https://developer.amazon.com/docs/in-app-purchasing/iap-obfuscate-the-code.html). Hello Amazon?


Solution as long as Amazon doesn't fix the issue: Disable R8 completely!


To disable R8, put this line in your gradle.properties:

android.enableR8=false


10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.