[SOLVED] Google Play IAB hasn't been initilized

The reason SDKBOX API worked this way is that I think Google play’s managed iap is quite hard to use, basically you can’t purchase something again if you didn’t consume it first. so we’re trying to replicate Apple Store’s iap, basically consumable and non-consumable.

If something is marked as non-consumable, user won’t be able to purchase it again, so it will work for something like remove ads, double the coin etc.

Hello, I am having the same issue about the Google Play IAB not being initialized.

You mentioned that i should modify the Cocos2dxActivity.java Instead of the AppActivity.java. I have done this, however My question is WHICH Cocos2dxActivity.java should i modify? I seem to have 2, one is in the cocos2d-x installation folder:
(/Users/LuisOscar/Documents/cocos2d-x-3.6/cocos/platform/android/java/src/org/cocos2dx/lib)
And the other is in the project folder:
(/Users/LuisOscar/Documents/CocosProjects/MyGame/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib)

I use cocos console on the terminal to build and release, and i think that one doesn’t even check the cocos2d-x files that are in my project, i think that one checks directly the files that are at the installation folder. Should i change my console configuration to use the project one instead?

On a side note, could you be so kind to clarify why there is a copied cocos2d folder on every project i create? Isn’t the cocos console supposed to be using the ones that are at the installation one? I’m just confused because both folders seem to have the same things inside.

Thank you

You should modify

/Users/LuisOscar/Documents/CocosProjects/MyGame/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib

Yes cocos console will create a copy of cocos2d-x, I was a decision made a while ago. the idea been, every game is different you might want to modify cocos2d-x source differently, I do believe, we need an option for people to use a shared engine core across all games…

I created a working sample for iap integration hope it helps
https://github.com/darkdukey/sdkbox-iap-sample

Thanks for the fast reply, i’m going through the project that you shared to me, but i still haven’t managed to find out exactly why its not working.

When i open the scene for in app purchases the listener method for “initialized” is called with the ok value flag set to false. Any idea what could be causing this?

It works perfectly on iOS but not on android. As soon as I open the scene the game crashes because of an assert from CCVector that says that no objects where added. But this is probably because the IAP is not being initialized correctly on the first place.

Can you share your log file from android?

Hello again, I think i finally solved the issue. I didn’t notice that there was no google account linked to the device. Once i added the account it worked. By the way, the bug of price, title, and description being empty is still precent. It happens if there is a line break in the description of ANY of the purchases (happens in both, iOS and Android).

I think i updated to the newest iap module using the sdkbox command line. I used the --forcedownload to get the newest, i think.

If this has already been fixed and i didn’t update correctly, would you mind being so kind to tell me how to update it? thanks.

I’ll look into that bug, well get back to you tomorrow.

I met the same issue… the log like this:

dump from: [string “app/scenes/Test.lua”]:168: in function <[string “app/scenes/SlotGameStartScene.lua”]:161>
D/cocos2d-x debug info( 4062): [LUA-print] - “onFailure:” = {
D/cocos2d-x debug info( 4062): [LUA-print] - “description” = “”
D/cocos2d-x debug info( 4062): [LUA-print] - “id” = “com.demo.coin1”
D/cocos2d-x debug info( 4062): [LUA-print] - “name” = “coin1”
D/cocos2d-x debug info( 4062): [LUA-print] - “price” = “”
D/cocos2d-x debug info( 4062): [LUA-print] - “title” = “”
D/cocos2d-x debug info( 4062): [LUA-print] - }
D/cocos2d-x debug info( 4062): [LUA-print] msg: Google Play IAB hasn’t been initilized.
E/BufferQueue( 103): [SurfaceView] dequeueBuffer: mMinUndequeuedBuffers=1 exceeded (dequeued=2)
E/BufferQueue( 103): [SurfaceView] dequeueBuffer: mMinUndequeuedBuffers=1 exceeded (dequeued=2)
E/BufferQueue( 103): [SurfaceView] dequeueBuffer: mMinUndequeuedBuffers=1 exceeded (dequeued=2)

Hi I have a question I am getting this error message as are others in this forum:

INF: SDKBox IAP: Invalid name iap item name: removeAd

I am new to this and trying to figure this out but for the life of me can’t. My app is set to go to be submitted except my IAP aren’t working and i get this error message every time i click on it. If anyone could help me that would be great.

If you could list the possible errors and solutions that would be great.

Do you have an item called this? What is in your sdkbox_config.json? What items are in your store?

Ill try to be as detailed as possible to get a solution::

this is my sdkbox_config.json:

{
    "android": {
        "GoogleAnalytics": {
            "trackingCode": "UA-68528847-3"
        }, 
        "Chartboost": {
            "signature": "82274eef59c474de3bbcc34bcc1a048b9308ac22",
            "ads": {
                "Default": {
                    "type": "interstitial"
                },
                "Level Complete": {
                    "type": "rewarded_video"
                },
                "MoreApp": {
                    "type": "more_app"
                }
            },
            "id": "561ee7bcc909a64aff41025e"
        },
        "iap": {
            "items": {
                "Skip": {
                    "id": "com.Nick.AlienAttackPopLockHDIAP.Skipp"
                    "type": "consumable"
                    
                },
                "removeAds": {
                    "id": "com.Nick.AlienAttackPopLockHDIAP",
                    "type": "non_consumable"
                }
            },
            "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2a3NzvT7ON9mSKm5PjBl0I60C/YVEjcp8bwK3ZYhKzhnk8XNgvZ7d2EYBm1gsr4vKVggSzk+JGVhZBWZQjyFq570Ck43fqAAnRu6I72zsuoA+gi/OsKBdk1aSk7+gxYn1Cnzo2HiK5hhg6N5Nrlwtjp2z7VDH7D25VMq7k/jzN967T7ek3wj+LC+maMuRReGl4G3C7ZByuNf7ugdY8FA7/ux4Bb/KDyvzG27ySOmMbb9o1ZBK/oorqZT9+P6QsxYY9+mrQlwKWRvvVb0TVL5t9EbHotNY2ST2pAgjN4My4ditp6hOURdkYtBBbMatYgywtqDrYZ/+5V5WPgO/vJm7QIDAQAB"
        }
    },
    "ios": {
        "GoogleAnalytics": {
            "trackingCode": "UA-68528847-3"
        }, 
        "Chartboost": {
            "signature": "82274eef59c474de3bbcc34bcc1a048b9308ac22",
            "ads": {
                "Default": {
                    "type": "interstitial"
                }, 
                "Level Complete": {
                    "type": "rewarded_video"
                }, 
                "MoreApp": {
                    "type": "more_app"
                }
            }, 
            "id": "561ee7bcc909a64aff41025e"
        },
        "iap": {
            "items": {
                "Skip": {
                    "id": "com.Nick.AlienAttackPopLockHDIAP.Skipp"
                    "type": "consumable"
                },
                "removeAds": {
                    "id": "com.Nick.AlienAttackPopLockHDIAP",
                    "type": "non_consumable"
                }
            }
        }
    }
}

this is my iTunes connect for IAP:

Reference Name Type Product ID Status
removeAd Non-Consumable com.Nick.AlienAttackPopLockHDIAP Ready to Submit
Skip Consumable com.Nick.AlienAttackPopLockHDIAP.Skipp Ready to Submit

You call it removeAds but you must be calling removeAd

I made that change but on Skip IAP i get the following pop-up error:

Error!
Invalid name iap item name

OK

and on my Remove Ads button a pop-up doesn’t occur. no Message

on both iap i get the following error on Xcode when running:

INF: SDKBox IAP: Invalid name iap item name: removeAd
INF: SDKBox IAP: Invalid name iap item name: Skip

any where else I should check for errors?
Please provide your expertise on this issue, Im stuck.

Your sdkbox_config.json contains invalid json format.

You can copy&paste it to a json validator and it will tells you where.

These are the errors:

Error:Expecting comma, colon or }, not string.[Code 11, Structure 65]
Error:Expecting comma, colon or }, not string.[Code 11, Structure 76]
Error:Invalid comma, expecting }.[Code 141, Structure 79]
Error:Expecting string, not }.[Code 8, Structure 80]
Error:Expecting comma, colon or }, not string.[Code 11, Structure 151]
Error:Expecting comma, colon or }, not string.[Code 11, Structure 162]
Error:Expecting closing } at end[Code 22, Structure 169]

{
“android”:{
“GoogleAnalytics”:{
“trackingCode”:“UA-68528847-3”
},
“Chartboost”:{
“signature”:“82274eef59c474de3bbcc34bcc1a048b9308ac22”,
“ads”:{
“Default”:{
“type”:“interstitial”
},
“Level Complete”:{
“type”:“rewarded_video”
},
“MoreApp”:{
“type”:“more_app”
}
},
“id”:“561ee7bcc909a64aff41025e”
},
“iap”:{
“items”:{
“skip”:{
“id”:“com.Nick.AlienAttackPopLockHDIAP.Skipp” “type”:“consumable”
},
“removeAd”:{
“id”:“com.app.AlienAttackPopLockHD.RemoveAd” “type”:“non-consumable”,

        },
        "key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2a3NzvT7ON9mSKm5PjBl0I60C/YVEjcp8bwK3ZYhKzhnk8XNgvZ7d2EYBm1gsr4vKVggSzk+JGVhZBWZQjyFq570Ck43fqAAnRu6I72zsuoA+gi/OsKBdk1aSk7+gxYn1Cnzo2HiK5hhg6N5Nrlwtjp2z7VDH7D25VMq7k/jzN967T7ek3wj+LC+maMuRReGl4G3C7ZByuNf7ugdY8FA7/ux4Bb/KDyvzG27ySOmMbb9o1ZBK/oorqZT9+P6QsxYY9+mrQlwKWRvvVb0TVL5t9EbHotNY2ST2pAgjN4My4ditp6hOURdkYtBBbMatYgywtqDrYZ/+5V5WPgO/vJm7QIDAQAB"
     }
  },
  "ios":{  
     "GoogleAnalytics":{  
        "trackingCode":"UA-68528847-3"
     },
     "Chartboost":{  
        "signature":"82274eef59c474de3bbcc34bcc1a048b9308ac22",
        "ads":{  
           "Default":{  
              "type":"interstitial"
           },
           "Level Complete":{  
              "type":"rewarded_video"
           },
           "MoreApp":{  
              "type":"more_app"
           }
        },
        "id":"561ee7bcc909a64aff41025e"
     },
     "iap":{  
        "items":{  
           "skip":{  
              "id":"com.Nick.AlienAttackPopLockHDIAP.Skipp"                  "type":"consumable"
           },
           "removeAd":{  
              "id":"com.app.AlienAttackPopLockHD.RemoveAd"                  "type":"non-consumable"
           }
        }
     }
  }

}

Could you help me fix these errors.

i took out the “type”:“consumable”
and the “type”:“non-consumable” and it turned Valid.

But even with these changes the IAP does not work… I am still getting the Error! Invalid name iap item name when I click on Skip.

Any suggestions?

have you tried using skip instead of Skip?

Yes i have tried that also.

I deleted all attempts I made at the IAP and started from scratch. I plugged in my IAP IDs into the sdkbox_config.json and I’m getting this error now on my Xcode display for both Skip and RemoveAd buttons.

Error!

Invalid product please double check the product ID on iTunes connect.

My product ID is the same on the sdkbox_config.json as it is on my iTunes connect App Features.

Any ideas on why I’m experiencing this problem?
Does this seem like a problem I occurred from the iTunes side of things or Xcode ?

Perhaps I’m just setting up my IAPs incorrectly with iTunes.

Show me your products in iTunes Connect and show me your sdkbox_config.json