Android IAP: 'No license key was supplied to config.lua.'

Hi,

I’ve got problems implementing IAP in android. I can’t even init the store to start with because i’m getting the following error on start up: ‘No license key was supplied to config.lua.’

I use my release .keystore file to build with and have selected Google Play as target App Store in the “build for android dialog” of the simulator. After that I just install the generated .apk on my device with adb

Is there any error with the following config.lua? or are there any things I should pay attention to when debugging IAP on android?

application={    license={         google={             key="MY\_LONG\_KEY\_IS\_HERE"         }     },     content={         width = 160,         height = 240,         xAlign = "left",         yAlign = "top",         scale = 'letterbox',         fps = 60     } }

Your config.lua file seems fine.

Did you add this to your build.settings?

plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }

and

settings = { android = { usesPermissions = { "com.android.vending.BILLING", }, }, }

If you did, are you sure you put the right key in the config file?

@undecode
Yes the snippets you provided also exist within my build.settings file.

I double checked the key and it is an exact copy of the one I get on the Google Play Developer site. Also I doubt this error can be the cause of an invalid key if I see the source of the IAP V3 plugin.

https://github.com/coronalabs/plugins-source-google-iap-v3/blob/master/android/src/plugin/google/iap/v3/LuaLoader.java#L157

if (licenseKey.length() \< 1) { Log.w("Corona", "No license key was supplied to config.lua."); }

Just to ask the really dumb question.  You are replacing MY_LONG_KEY_IS_HERE with the really long string you got from Google Play right? You are also making sure there are no spaces at the beginning and end? That string should be inside the double quotes.

Rob

Yup, the actual snippet looks like this

application={ license={ google={ key="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhK3olPZOLQMOXFNlVnQIH23GyfSOYz5yJNF7TFhCcm/FFOqqIe06gaRnreplacedthispartheresonobodyknowstherealkeydxN1W15xXy0ifaUZZu/WDRsWFJo+Q2jgS9NLGP9R4LzOi2m0C4XN1lhYAuVfbm+agVnu1HcJ+B1VPcpbVQWaf/IQ8gxC9UuC6o1XrzhgZmB+ubpwIXa6Ef0lmNne52hd0+69quwkY5bo0zrpJU+5q7dpnEm04bIPez/WGVWFS+/cRqI+4E5h8GL76YniV1XiEDeMuZgdcaNFrxuYkFW9RfoPbFAd1kfR79KHr3QQCU/GHi43OAeJqEW/eSNvcU+4zJjhT2QIDAQAB" } }, content={ width = 160, height = 240, xAlign = "left", yAlign = "top", scale = 'letterbox', fps = 60 } }

You may not have enough permissions. Try:

            “android.permission.INTERNET”,
            “com.android.vending.BILLING”,
            “com.android.vending.CHECK_LICENSE”,

Your config.lua file seems fine.

Did you add this to your build.settings?

plugins = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }

and

settings = { android = { usesPermissions = { "com.android.vending.BILLING", }, }, }

If you did, are you sure you put the right key in the config file?

@undecode
Yes the snippets you provided also exist within my build.settings file.

I double checked the key and it is an exact copy of the one I get on the Google Play Developer site. Also I doubt this error can be the cause of an invalid key if I see the source of the IAP V3 plugin.

https://github.com/coronalabs/plugins-source-google-iap-v3/blob/master/android/src/plugin/google/iap/v3/LuaLoader.java#L157

if (licenseKey.length() \< 1) { Log.w("Corona", "No license key was supplied to config.lua."); }

Just to ask the really dumb question.  You are replacing MY_LONG_KEY_IS_HERE with the really long string you got from Google Play right? You are also making sure there are no spaces at the beginning and end? That string should be inside the double quotes.

Rob

Yup, the actual snippet looks like this

application={ license={ google={ key="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhK3olPZOLQMOXFNlVnQIH23GyfSOYz5yJNF7TFhCcm/FFOqqIe06gaRnreplacedthispartheresonobodyknowstherealkeydxN1W15xXy0ifaUZZu/WDRsWFJo+Q2jgS9NLGP9R4LzOi2m0C4XN1lhYAuVfbm+agVnu1HcJ+B1VPcpbVQWaf/IQ8gxC9UuC6o1XrzhgZmB+ubpwIXa6Ef0lmNne52hd0+69quwkY5bo0zrpJU+5q7dpnEm04bIPez/WGVWFS+/cRqI+4E5h8GL76YniV1XiEDeMuZgdcaNFrxuYkFW9RfoPbFAd1kfR79KHr3QQCU/GHi43OAeJqEW/eSNvcU+4zJjhT2QIDAQAB" } }, content={ width = 160, height = 240, xAlign = "left", yAlign = "top", scale = 'letterbox', fps = 60 } }

You may not have enough permissions. Try:

            “android.permission.INTERNET”,
            “com.android.vending.BILLING”,
            “com.android.vending.CHECK_LICENSE”,