Our App will crash, we are right now change the billing Plugin from:
“plugin.google.iap.v3” to “plugin.google.iap.billing”
(plugin “plugin.google.iap.v3” everything was working fine)
Our Project is a native build. That means we are added the JAR file in the Android libs:
“plugin.google.iap.billing.jar” and delete the old one.
(https://github.com/coronalabs/com.coronalabs-plugin.google.iap.billing)
and added the dependency notation “com.android.billingclient:billing:3.0.1” in the gradle build file.
App starts and on the first press on an offer the plugin will work perfectly. The native buy-layer will popup with the correct price and the shopItem is buyable.
But on second press, same product-id and the triggers same function the app is crashing.
SOLAR2D CODE:
local store = require( "plugin.google.iap.billing" )
local function onPressBuy(storeProductId,isSubscription)
print("playstorePreBuyPurchaseManager > onPressBuy - storeProductId:", storeProductId , " isSubscription:", isSubscription)
if isSubscription==true then
store.purchaseSubscription(storeProductId)
else
store.purchase(storeProductId) -- Code-Line: 130
end
end
NATIVE LOG:
---- PRESS BUY First Time
2021-04-20 17:22:41.514 11133-11598/? I/Corona: onPressBuy storeProductId: offer_99_playstore isSubscription: false
---- HERE THE NATIVE BUY CONTEXT IS VISIBLE (Close Window without or with buy shop-item)
---- PRESS BUY Second Time
2021-04-20 17:23:06.307 11133-11598/? I/Corona: onPressBuy storeProductId: offer_99_playstore isSubscription: false
2021-04-20 17:23:06.311 11133-11598/? I/Corona: src/manager/playstorePreBuyPurchaseManager.lua:130: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
Java Stack Trace:
com.android.billingclient.api.BillingClientImpl.launchBillingFlow(com.android.billingclient:billing@@3.0.1:225)
plugin.google.iap.billing.LuaLoader.purchaseType(LuaLoader.java:360)
plugin.google.iap.billing.LuaLoader.purchase(LuaLoader.java:401)
plugin.google.iap.billing.LuaLoader.access$1700(LuaLoader.java:39)
plugin.google.iap.billing.LuaLoader$PurchaseWrapper.invoke(LuaLoader.java:577)
com.naef.jnlua.LuaState.lua_pcall(Native Method)
com.naef.jnlua.LuaState.call(LuaState.java:564)
com.ansca.corona.CoronaLua.dispatchEvent(CoronaLua.java:140)
network.NetworkRequest$LuaCallback$1.executeUsing(NetworkRequest.java:612)
com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:179)
com.ansca.corona.events.EventManager.sendEvents(EventManager.java:100)
com.ansca.corona.Controller.updateRuntimeState(Controller.java:319)
com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:434)
com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1625)
com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380)
at purchase (External Function)
at onPressBuy (/Users/kkk/app/Corona/src/manager/playstorePreBuyPurchaseManager.lua:130)
at onResultCallback (/Users/kkk/app/Corona/src/manager/playstorePreBuyPurchaseManager.lua:175)
at (Unknown Function) (/Users/kkk/app/Corona/src/manager/apiManager.lua:174)