Replace the verifyPurchase() method below. Use the old code below, the google developer is trying to resolve this error in the near future, but before you update your code, you must select the code below.
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (signedData == null) { Log.e(TAG, "data is null"); return false; } boolean verified = false; if (!TextUtils.isEmpty(signature)) { PublicKey key = Security.generatePublicKey(base64PublicKey); verified = Security.verify(key, signedData, signature); if (!verified) { Log.w(TAG, "signature does not match data."); return false; } } return true; }
check this link for more information:
Application billing does not work after upgrade - Google Store
Use an attempt to replace the OLD CODE method of verifyPurchase() in your project. But this should only happen when you are trying to purchase test products. Let me know about buying real products also after using this code.
Edit:
Why is this happening because we will not receive any signature while we use a dummy product, for example "android.test.purchased". Therefore, in the old code, it works well, because we returned even if the signature is not specified, and for the new code we return false.
more information about signature data, empty or empty, from link1 and link2
Therefore, I suggest that you simply replace the old verifyPurchase() code method instead of the New Code method.
I think New Code will work fine for a real product, but not in a dummy product. But so far I have not tested the real product.
or
use the GvS answer for the test, it is also a good solution for the new code.
Hope this solves your problem.