j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 535 forks source link

Error 6777001 : Init Failed - String resource ID #0*0 #74

Closed Moussawi7 closed 10 years ago

Moussawi7 commented 10 years ago

HI @j3k0 , In fact I created a sample application using the example code, also i created a preference tag in my app/res/xml/config.xml: . unfortunately i got an error message saying: "Error 6777001 : Init Failed - String resource ID #0*0". note that my cordova version is 3.6 . Thank you.

j3k0 commented 10 years ago

That is on Android, right?

Can you show the source-code and the output from adb logcat?

astagi commented 10 years ago

Same here

D/JsMessageQueue( 8596): Set native->JS mode to OnlineEventsBridgeMode D/CordovaWebViewClient( 8596): onPageFinished(file:///android_asset/www/index.html) D/CordovaActivity( 8596): onMessage(onPageFinished,file:///android_asset/www/index.html) D/CordovaActivity( 8596): onMessage(spinner,stop) D/CordovaPurchase( 8596): Num SKUs Found: 1 D/CordovaPurchase( 8596): Product SKU Added: uk.co.mycomp.test.prova D/CordovaPurchase( 8596): init start W/ResourceType( 8596): No package identifier when getting value for resource number 0x00000000 E/PluginManager( 8596): Uncaught exception from plugin E/PluginManager( 8596): android.content.res.Resources$NotFoundException: String resource ID #0x0 E/PluginManager( 8596): at android.content.res.Resources.getText(Resources.java:265) E/PluginManager( 8596): at android.content.res.Resources.getString(Resources.java:351) E/PluginManager( 8596): at android.content.Context.getString(Context.java:345) E/PluginManager( 8596): at com.smartmobilesoftware.inappbilling.InAppBillingPlugin.init(InAppBillingPlugin.java:122) E/PluginManager( 8596): at com.smartmobilesoftware.inappbilling.InAppBillingPlugin.execute(InAppBillingPlugin.java:67) E/PluginManager( 8596): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:84) E/PluginManager( 8596): at org.apache.cordova.PluginManager.exec(PluginManager.java:147) E/PluginManager( 8596): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) E/PluginManager( 8596): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40) E/PluginManager( 8596): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) E/PluginManager( 8596): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:24) E/PluginManager( 8596): at android.os.Handler.dispatchMessage(Handler.java:102) E/PluginManager( 8596): at android.os.Looper.loop(Looper.java:136) E/PluginManager( 8596): at android.os.HandlerThread.run(HandlerThread.java:61) D/CordovaLog( 8596): file:///android_asset/www/js/index.js: Line 41 : Uncaught TypeError: Cannot call method 'querySelector' of null

j3k0 commented 10 years ago

Can you activate DEBUG level verbosity?

store.verbosity = store.DEBUG;
j3k0 commented 10 years ago

From the error, it looks that the billing key can't be found: see here https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#add-android-billing-key

@Moussawi7 billing key shouldn't be added to app/res/xml/config.xml but in a file named platform/android/res/values/billing_key.xml

astagi commented 10 years ago

Ok I set billing_key.xml and seems to work! :) thanks... anyway when I try to get the price of my item I get null!.. I registered my app on play store (not published) and I created an item, on my computer I run my app in debug mode, and there I get null item.. maybe I'm missing something else in my config

astagi commented 10 years ago

Seems that I need to publish my app before using in app purchase with my items.. I tried your plugin using

            store.register({
                id:    "android.test.purchased",
                alias: "100 coins",
                type:  store.CONSUMABLE
            });

and it works!

j3k0 commented 10 years ago

Yes you need to publish. You can publish a private "alpha" version and it'll work.

Good that it works! @Moussawi7, i'll close this issue, do not hesitate to ask if you need more assistance.

astagi commented 10 years ago

I spoke too early :) when I buy android.test.purchased all seems going well, but my approved or finished callbacks get never fired

            store.when("100 coins").finished(function (order) {
                alert("FINISH!");
            });

            store.when("100 coins").approved(function (order) {
                alert("APPROVED!");
            });

When I try to launch the app again I get an error

ERROR 6777001: Init failed - Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: 6777017:Error)

My keys are ok, I just want to test my app locally with android.test.purchased item

Moussawi7 commented 10 years ago

hi @j3k0 , Oh, really thank you, as my CTO always said "2astazeh" :) . Shokran ktir :) In fact, may you have to correct the documentation: https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/android.md#add-your-license-key

j3k0 commented 10 years ago

Ahla w sahla!:) You're right for the doc, updated in #65

gianni972 commented 9 years ago

Hello,

I'm using the plugin with telerik (cordova) it works fine with iOS but with android I think there is something that I'm wrong with this file: platform/android/res/values/billing_key.xml This means that billing_key.xml should be in values folder that should be in res folder that should be in android folder that should be in platform folder ? If yes the platform folder should be in the root of project or in the plugin folder ?

Googling on it I found something like this:

    <config-file target="res/values/billing_key.xml" parent="/*">
        <string name="billing_key">.......</string>
    </config-file>

that I assume will be added in plugin.xml in the android section ? and than create, in the plugin folder, a res folder with into the values folder with an empty billing_key.xml file.

the error I got in android is Error 6777001 : Init Failed - String resource ID #0*0 I have uploaded a signed app in alpha state, create in-app purchase and run on my android phone a signed app (signed as alpha)

Please help me :) Thank you

j3k0 commented 9 years ago

Hey, latest release allows to set the billing_key using a variable. This adds support for PhoneGap Build. Telerik users should be able to make use of that too: http://docs.telerik.com/platform/appbuilder/creating-your-project/using-plugins/set-plugin-variable

If someone can get this done and can provide instructions, I'll gladly add that to the documentation.