Google IAP v3 crashing on store.init()

Hello!

I’m trying to set up Google IAP v3 on my game and when I call store.init(), my app crashes. I’m testing the game on my device which is a Samsung Galaxy Tab 3 and I’m using Corona Version 2014.2511 (2014.11.18).

I’ve come to the conclusion that when I call store.init( “google”, storeTransaction ) the game crashes on me. I tried following the documentation and stripped out everything else from my scene for troubleshooting, but I still get the same crash. Am I missing something in my build.settings?

scene-store.lua

local sceneName = ... local composer = require( "composer" ) local scene = composer.newScene( sceneName ) local widget = require "widget" local store local v3 = false if ( system.getInfo( "platformName" ) == "Android" ) then     store = require( "plugin.google.iap.v3" )     v3 = true elseif ( system.getInfo( "platformName" ) == "iPhone OS" ) then     store = require( "store" ) else     native.showAlert( "Notice", "In-app purchases are not supported in the Corona Simulator.", { "OK" } ) end local function storeTransaction( event )     local transaction = event.transaction     if ( transaction.state == "purchased" ) then         --handle a successful transaction here         print( "productIdentifier", transaction.productIdentifier )         print( "receipt", transaction.receipt )         print( "signature:", transaction.signature )         print( "transactionIdentifier", transaction.identifier )         print( "date", transaction.date )     elseif ( transaction.state == "cancelled" ) then         --handle a cancelled transaction here     elseif ( transaction.state == "failed" ) then         --handle a failed transaction here     end     --tell the store that the transaction is complete!     --if you're providing downloadable content, do not call this until the download has completed     store.finishTransaction( event.transaction ) end store.init( "google", storeTransaction ) --------------------------------------------------------------------------------- function scene:create( event )     local sceneGroup = self.view     local bg = display.newImageRect("images/panels & screens/store\_screen.png", \_S.width, \_S.height)     local backBtn = widget.newButton{         defaultFile = "images/buttons/btn\_back.png",         overFile = "images/buttons/btn\_back\_over.png",         width = 65 \* 2,         height = 25 \* 2,         x = 0,         y = 0,         onRelease = function(event)             local sceneOptions = {                 effect = "slideRight",                 time = 400,             }             composer.gotoScene("scene-game", sceneOptions)         end,     }     bg.x = \_S.centerX     bg.y = \_S.centerY     backBtn.x = 100     backBtn.y = 50     sceneGroup:insert(bg)     sceneGroup:insert(backBtn)          end -- Listener setup scene:addEventListener( "create", scene ) return scene

build.settings

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = {          orientation = {         default = "landscapeRight",         supported = { "landscapeLeft", "landscapeRight"}     },     plugins =     {         ["plugin.google.iap.v3"] =         {             publisherId = "com.coronalabs",             supportedPlatforms = { android=true }         },     },          iphone = {         plist = {             UIStatusBarHidden = false,             UIPrerenderedIcon = true, -- set to false for "shine" overlay                         UIAppFonts =             {                 "BebasNeue.otf",                 "PoetsenOne-Regular.ttf",             },             UIViewControllerBasedStatusBarAppearance = false,             UIApplicationExitsOnSuspend = false,             UIPrerenderedIcon = true,             CFBundleIconFile = "Icon.png",             CFBundleIconFiles = {                 "Icon.png",                 "Icon@2x.png",                 "Icon-72.png",                 "Icon-72@2x.png",                 "Icon-60.png",                 "Icon-76.png",                 "Icon-120.png",                 "Icon-152.png"             },                           }     },     android =     {        usesPermissions =        {                 "android.permission.INTERNET",                 "com.android.vending.BILLING",                 "android.permission.WRITE\_EXTERNAL\_STORAGE",                 "com.android.vending.CHECK\_LICENSE",                                            "android.permission.ACCESS\_NETWORK\_STATE",        },     },     license =   {       google =       {           key = "my key",       },   }, }

I have exact same issue. It happened between builds. One was working perfectly the next one started freezing.

This must be plugin related, since it works perfectly on iOS. There is also another topic on the same issue posted also today.

http://forums.coronalabs.com/topic/53276-storeinitgoogle-transactioncallback-crashes/?hl=store.init

Hi all,

Can one (or both) of you provide a console error log report? We tried the code that @thatssopanda supplied and we can’t reproduce the issue.

Thanks,

Brent

The problem is, that there is no log error.

App is not responding.

Here is ANR report from Google Play

ANR Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50000010 }

Hello,

When running adb logcat Corona:v *:s from my Samsung Galaxy Tab 3, here’s what I get:

V/Corona&nbsp; (12972): \> Class.forName: network.LuaLoader V/Corona&nbsp; (12972): \< Class.forName: network.LuaLoader V/Corona&nbsp; (12972): Loading via reflection: network.LuaLoader I/Corona&nbsp; (12972): Platform: SM-T217S / ARM Neon / 4.4.2 / Adreno (TM) 305 / OpenGL ES 3.0 V@45.0 AU@04.04.02.007.050 (CL@) / 2014.2511 V/Corona&nbsp; (12972): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona&nbsp; (12972): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona&nbsp; (12972): Loading via reflection: CoronaProvider.licensing.google.LuaLoader V/Corona&nbsp; (12972): \> Class.forName: plugin.google.iap.v3.LuaLoader V/Corona&nbsp; (12972): \< Class.forName: plugin.google.iap.v3.LuaLoader V/Corona&nbsp; (12972): Loading via reflection: plugin.google.iap.v3.LuaLoader

Once I get to V/Corona  (12972): Loading via reflection: plugin.google.iap.v3.LuaLoader_,_ the app will freeze and not respond to further interaction. I don’t get why it would freeze at that last line. Any hints?

Same here.

–EDIT

I’ve tried building it on Mac. Same issue.

Hi,

I  tired using the daily build too, but the issue is still observed.

Can corona give a correct information about this?

Stuck on this issue since 4 days.

Has anyone filed a bug report?  A case number would be great to have before I ping engineering.

Rob

Hello Rob,

I just filed the bug report and the case number is (Case 37734).

Daniel

I don’t know if you did anything to plugin, but it’s working for me now (with no changes in code).

Hi @delwing

Please check my build.settings here

http://forums.coronalabs.com/topic/51047-in-app-purchases-iap-storeinit-freezes-the-application/#entry277172

And let me know if something is wrong with my plugin.

@rohan.k, plugins are things that exist on Corona’s servers.  We can fix them and all you have to do is re-build to get fixes unlike Corona SDK where you have to download new builds to get fixes.

@delwing, Are you saying you can get past store.init() now?  The bug report filed @thatssopanda is still having a good back and forth between @thatssopanda and the engineer working on it.

Is anyone still having any issues?

I am having this issue right now… struggling with it for hours now.

Building for google play and application just hangs at line of code

store.init("google",&nbsp;transactionCallback)

There are no errors. Nothing is happening.

I downloaded plugins from few hours ago (plugins and daily enterprise edition)

I suspect these may not be in the Enterprise build yet.  Let me ask about it.

Rob

I just read in some other topic that this might be related to the fact that app has been freshly published in the app store as alpha.

I am curious, what if the information hasn’t yet been propagated? What if app can’t get store info because it hasn’t been published yet?

I published my app more than 24 hours ago, but still…maybe that’s the case.

There was a bug Engineering fixed in store.init() today.  It’s probably not had time to get into a daily build for Enterprise users.

Rob

Got it. My mistake! I didn’t add license key to my config.lua file.

It might have helped if there was some kind of warning if using google store and key is not present in config.lua

hi 

Is it necessary to upload every time the build and test the IAP for each build on google play  ?

or can we test it directly deploying to device.

Hi @Rob, The issue is still observed.

I have just checked.