Amazon IAP causes black screen

Hello Corona Community!

I need some help with Amazon In-app Purchases! I’ve been able to use Amazon In-app Purchases on a previous app, but for some reason, I can’t get it to work on the latest build that I’m using - 2014.2407.

Here’s what I’ve done:

I’ve built a game called Rebus Puzzles with in-app purchases and it can be found here - https://play.google.com/store/apps/details?id=com.thatssopanda.rebuspuzzles. The IAPs work great on Google Play. Next, I worked on making available on Amazon App Store by changing the store.init to the follow code:

store = require("store") if(store.target == "amazon") then   store = require "plugin.amazon.iap"     store.init(transactionCallback) elseif(store.target == "google") then   store.init("google", transactionCallback) else   store.init("apple", transactionCallback) end

When I submitted Rebus Puzzles to Amazon, they rejected it stating the app loads up a blank screen. I did confirm this using their App Testing Service. So, I commented out the above lines and resubmitted just out of curiosity, but this time the rejected it because the IAPs did not work.

I know the IAPs wouldn’t work because store.init() wasn’t called; I was just curious.

Since commenting out the above lines made my app work, is there something that changed with Amazon IAPs? Do I need to call the plugin a different way or use a different build version? Here’s my build.settings:

build.settings:

plugins =     {                 ["plugin.amazon.iap"] =         {             publisherId = "com.amazon",             supportedPlatforms = { android=true },         },         ["CoronaProvider.ads.vungle"] =         {             -- required             publisherId = "com.vungle",         },                  ["CoronaProvider.native.popup.social"] =         {             --required             publisherId = "com.coronalabs",         },     }

Update:

I used Amazon’s App Testing Service and confirmed what they saw. When commenting out the store.init() code, the app pulls up fine. When re-including the store.init() code, the app displays a blank screen. I’m sure I’m missing something.

If you need to look at the logcat for the app that shows a blank screen, please click on the link below.

https://drive.google.com/file/d/0B2xgf62UVgDyYVowb0psR19nVzQ/edit?usp=sharing

Hi Daniel, 

Sorry to hear you are having issues!

Here are the relevant lines from your logcat

09-17 08:03:47.672 12328 12374 V Corona : \> Class.forName: plugin.amazon.iap.LuaLoader 09-17 08:03:47.672 12328 12374 V Corona : WARNING: Could not load 'LuaLoader' 09-17 08:03:47.672 12328 12374 W System.err: java.lang.ClassNotFoundException: plugin.amazon.iap.LuaLoader 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.classForName(Native Method) 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.forName(Class.java:217) 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.forName(Class.java:172) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:319) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381) 

For some reason the plugin is not included in your built apk. Do the other plugins in your build.settings work? The ‘plugins’ table should be part of a ‘settings’ table, which I am not seeing, although I suspect this is due to your copy and paste. If you didn’t have the ‘settings’ table, I don’t think any of the plugins would work. Just thought I’d mention it.

Did you test with the Amazon SDK Tester on your device before publishing? You should do this before publishing to ensure your code is working correctly. You can install this on any Android device, an Amazon device is not required.

Hello tamkinp!

That definitely pinpoints the issue! I’ve copied and pasted my build.settings file exactly as I have it. The plugin for Vungle worked out just fine, just not the Amazon In-App Purchases. Can you take a look at my build.settings file to see if I missed something?

I didn’t realize Amazon SDK Tester was available for all android devices. For whatever reason, I was under the assumption that it was only available for Kindle devices.

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = {     orientation =     {         default = "portrait",         supported = { "portrait", "portraitUpsideDown" },     },          android =     {         usesPermissions =         {             "android.permission.INTERNET",             "com.android.vending.BILLING",               "android.permission.WRITE\_EXTERNAL\_STORAGE",               "com.android.vending.CHECK\_LICENSE",                      },     },          iphone =     {         plist =         {                         UIAppFonts = {"Exo2-Bold.ttf","Exo2-Light.ttf"},             UIStatusBarHidden=true,             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"             },             FacebookAppID = "1440496446189783",  --replace XXXXXXXXXX with your Facebook App ID             CFBundleURLTypes = {                 {                 CFBundleURLSchemes = { "fb1440496446189783", }  --replace XXXXXXXXXX with your Facebook App ID                 }             }         },     },     plugins =     {                 ["plugin.amazon.iap"] =         {             publisherId = "com.amazon",             supportedPlatforms = { android=true },         },         ["CoronaProvider.ads.vungle"] =         {             -- required             publisherId = "com.vungle",         },                  ["CoronaProvider.native.popup.social"] =         {             --required             publisherId = "com.coronalabs",         },     } }

Hi Daniel,

Try removing the ‘supportedPlatforms’ line. Test this with the SDK tester and let me know your results.

EDIT: I’m almost positive this is your problem. The ‘supportedPlatforms’ key was added to the doc recently, it didn’t used to be there. You want supportedPlatforms to be this:

supportedPlatforms = { ["android-kindle"] = true }

Setting it to ‘android’ means you only get the plugin on a Google Play build, which is certainly not what you want. Let me know your results and I can help get the docs updated. 

Hello,

I didn’t realize it was changed from android=true to “android-kindle”. I’ll put in a request to Corona to modify the documentation as this is a pretty big difference!

I submitted the app to App Service Tester and it looks like everything is working now. Thank you so much! I’d love to buy you a virtual beer (or equivalent drink if under 21)!!!

I am trying to implement Amazon IAP for corona enterprise but it’s not working.

I added in-app-purchasing-1.0.3.jar and plugin.amazon.iap.jar in libs folder on my android project also I added 

<receiver android:name = “com.amazon.inapp.purchasing.ResponseReceiver” >

        <intent-filter>

            <action android:name = “com.amazon.inapp.purchasing.NOTIFY”

                    android:permission = “com.amazon.inapp.purchasing.Permission.NOTIFY” />

        </intent-filter>

 </receiver>

in androidmanifest.xml file.

I installed the app and open the app it appears blank screen also installed amazonSDKtester.apk file.

I don’t know the problem why it’s not working.Please help me.

Note:

But when i build apk from corona sdk Simulator and test the app it’s working also Amazon inapp purchase working.

Update:

I used Amazon’s App Testing Service and confirmed what they saw. When commenting out the store.init() code, the app pulls up fine. When re-including the store.init() code, the app displays a blank screen. I’m sure I’m missing something.

If you need to look at the logcat for the app that shows a blank screen, please click on the link below.

https://drive.google.com/file/d/0B2xgf62UVgDyYVowb0psR19nVzQ/edit?usp=sharing

Hi Daniel, 

Sorry to hear you are having issues!

Here are the relevant lines from your logcat

09-17 08:03:47.672 12328 12374 V Corona : \> Class.forName: plugin.amazon.iap.LuaLoader 09-17 08:03:47.672 12328 12374 V Corona : WARNING: Could not load 'LuaLoader' 09-17 08:03:47.672 12328 12374 W System.err: java.lang.ClassNotFoundException: plugin.amazon.iap.LuaLoader 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.classForName(Native Method) 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.forName(Class.java:217) 09-17 08:03:47.672 12328 12374 W System.err: at java.lang.Class.forName(Class.java:172) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:319) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 09-17 08:03:47.672 12328 12374 W System.err: at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381) 

For some reason the plugin is not included in your built apk. Do the other plugins in your build.settings work? The ‘plugins’ table should be part of a ‘settings’ table, which I am not seeing, although I suspect this is due to your copy and paste. If you didn’t have the ‘settings’ table, I don’t think any of the plugins would work. Just thought I’d mention it.

Did you test with the Amazon SDK Tester on your device before publishing? You should do this before publishing to ensure your code is working correctly. You can install this on any Android device, an Amazon device is not required.

Hello tamkinp!

That definitely pinpoints the issue! I’ve copied and pasted my build.settings file exactly as I have it. The plugin for Vungle worked out just fine, just not the Amazon In-App Purchases. Can you take a look at my build.settings file to see if I missed something?

I didn’t realize Amazon SDK Tester was available for all android devices. For whatever reason, I was under the assumption that it was only available for Kindle devices.

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { &nbsp;&nbsp; &nbsp;orientation = &nbsp;&nbsp; &nbsp;{ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;default = "portrait", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;supported = { "portrait", "portraitUpsideDown" }, &nbsp;&nbsp; &nbsp;}, &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;android = &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usesPermissions = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "android.permission.INTERNET", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "com.android.vending.BILLING", &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"android.permission.WRITE\_EXTERNAL\_STORAGE", &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"com.android.vending.CHECK\_LICENSE",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;iphone = &nbsp;&nbsp; &nbsp;{ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;plist = &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UIAppFonts = {"Exo2-Bold.ttf","Exo2-Light.ttf"}, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UIStatusBarHidden=true, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UIViewControllerBasedStatusBarAppearance = false, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UIApplicationExitsOnSuspend = false, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;UIPrerenderedIcon = true, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CFBundleIconFile = "Icon.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CFBundleIconFiles = { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon@2x.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-72.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-72@2x.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-60.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-76.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-120.png", &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Icon-152.png" &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FacebookAppID = "1440496446189783",&nbsp; --replace XXXXXXXXXX with your Facebook App ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFBundleURLTypes = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFBundleURLSchemes = { "fb1440496446189783", }&nbsp; --replace XXXXXXXXXX with your Facebook App ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}, &nbsp;&nbsp; &nbsp;}, &nbsp;&nbsp; &nbsp;plugins = &nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;["plugin.amazon.iap"] = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; publisherId = "com.amazon", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; supportedPlatforms = { android=true }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ["CoronaProvider.ads.vungle"] = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- required &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; publisherId = "com.vungle", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ["CoronaProvider.native.popup.social"] = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --required &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; publisherId = "com.coronalabs", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, &nbsp;&nbsp;&nbsp; } }

Hi Daniel,

Try removing the ‘supportedPlatforms’ line. Test this with the SDK tester and let me know your results.

EDIT: I’m almost positive this is your problem. The ‘supportedPlatforms’ key was added to the doc recently, it didn’t used to be there. You want supportedPlatforms to be this:

supportedPlatforms = { ["android-kindle"] = true }

Setting it to ‘android’ means you only get the plugin on a Google Play build, which is certainly not what you want. Let me know your results and I can help get the docs updated. 

Hello,

I didn’t realize it was changed from android=true to “android-kindle”. I’ll put in a request to Corona to modify the documentation as this is a pretty big difference!

I submitted the app to App Service Tester and it looks like everything is working now. Thank you so much! I’d love to buy you a virtual beer (or equivalent drink if under 21)!!!

I am trying to implement Amazon IAP for corona enterprise but it’s not working.

I added in-app-purchasing-1.0.3.jar and plugin.amazon.iap.jar in libs folder on my android project also I added 

<receiver android:name = “com.amazon.inapp.purchasing.ResponseReceiver” >

        <intent-filter>

            <action android:name = “com.amazon.inapp.purchasing.NOTIFY”

                    android:permission = “com.amazon.inapp.purchasing.Permission.NOTIFY” />

        </intent-filter>

 </receiver>

in androidmanifest.xml file.

I installed the app and open the app it appears blank screen also installed amazonSDKtester.apk file.

I don’t know the problem why it’s not working.Please help me.

Note:

But when i build apk from corona sdk Simulator and test the app it’s working also Amazon inapp purchase working.