Closed evolapp closed 9 years ago
@evolapp Add logs, please
02-01 22:07:11.715: D/(17634): Setup finished. 02-01 22:07:11.715: D/(17634): Setup successful. Querying inventory. 02-01 22:07:11.715: W/dalvikvm(17634): threadid=11: thread exiting with uncaught exception (group=0x410d5930) 02-01 22:07:11.715: E/AndroidRuntime(17634): FATAL EXCEPTION: Thread-765 02-01 22:07:11.715: E/AndroidRuntime(17634): java.lang.NullPointerException 02-01 22:07:11.715: E/AndroidRuntime(17634): at org.onepf.oms.appstore.SamsungAppsBillingService.queryInventory(SamsungAppsBillingService.java:233) 02-01 22:07:11.715: E/AndroidRuntime(17634): at org.onepf.oms.OpenIabHelper.queryInventory(OpenIabHelper.java:907) 02-01 22:07:11.715: E/AndroidRuntime(17634): at org.onepf.oms.OpenIabHelper$5.run(OpenIabHelper.java:934) 02-01 22:07:11.715: E/AndroidRuntime(17634): at java.lang.Thread.run(Thread.java:856)
thanks!
I wasn't able to reproduce your crash. Can you please post here options you used in you app? Also, can you try turning checkInventory
option on and off and see if it has any effect?
maybe u can send me your apk (evolapp at gmail)( or i send u mine) and then i can try it on the device. Be sure your apk is set to use samsung in-app purchase, thanks. p.s. it will be too troublesome if I have to uninstall googleplay and amazon to try samsungapp, then uninstall googleplay and samsungapp to try amazon, etc.
maybe u can send me your apk
I've tried to reproduce your issue with out sample app Trivial Drive. You can build it yourself, no need to send anything.
Be sure your apk is set to use samsung in-app purchase
That's why I've asked you to share options you've used. So I could try to reproduce the crash with exact same options set.
p.s. it will be too troublesome if I have to uninstall googleplay and amazon to try samsungapp, then uninstall googleplay and samsungapp to try amazon, etc.
There shouldn't be need for that. Library is supposed to pick most suitable store according to Options you provide.
ok, i tried to upgrade the latest openiab but i failed to do so.
======================new code ===
OpenIabHelper.Options options = new OpenIabHelper.Options.Builder()
//set params
.setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT)
.addAvailableStoreNames(OpenIabHelper.NAME_AMAZON)
.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP)
.addPreferredStoreName(OpenIabHelper.NAME_AMAZON)
.build();
mHelper = new OpenIabHelper((getApplicationContext(), options);
========================== old code====
// Context mContext = getApplicationContext();
// Options opts = new Options();
// opts.availableStores = new ArrayList
and what I gone in onIabSetupFinished(IabResult result) is: No suitable appstore was found (response: 3:Billing Unavailable)
any idea on why this happened?
thank a lot
.addAvailableStoreNames(OpenIabHelper.NAME_AMAZON)
If you're trying to utilize Samsung store, why do you restrict library to only Amazon option?
mHelper = new OpenIabHelper((getApplicationContext(), options);
If you want to use Samsung, you must supply Activity as a context for OpenIabHelper. Don't worry, it won't leak.
And if you're trying to test Amazon, you must install apk with adb install -i com.amazon.venezia /path/to/YourApp.apk
as suggested in our documentation.
I plan to test with amazon first because I used old version of openiab and got no problem in googleplay and amazon. The old version of openiab does not require me to install app with "com.amazon.venezia".. anyway, let me try and update this soon/
I tried the trivaldriver example, not sure why, but it does not work.
.addStoreKeys(InAppConfig.STORE_KEYS_MAP)
02-05 22:04:31.595: E/AndroidRuntime(12532): Caused by: java.lang.NullPointerException 02-05 22:04:31.595: E/AndroidRuntime(12532): at org.onepf.oms.OpenIabHelper$Options$Builder.addStoreKeys(OpenIabHelper.java:1968)
the static class static variable is null, i.e. int() is not called.
.addStoreKeys(InAppConfig.STORE_KEYS_MAP)
I don't know where you put this line, but apparently somewhere before this call: https://github.com/onepf/OpenIAB/blob/master/samples/trivialdrive/src/main/java/org/onepf/sample/trivialdrive/MyApp.java#L13
my false, my careless, spended one hour and still not yet recognized the mistake, thank for your hints. I am still testing, update the result soon, thanks
still got problem in samsungapp:
(directly reused InAppConfig)
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder()
.setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT)
//.setVerifyMode(OpenIabHelper.Options.VERIFY_EVERYTHING)
// .addAvailableStoreNames(OpenIabHelper.NAME_GOOGLE)
.addAvailableStoreNames(OpenIabHelper.NAME_AMAZON)
.addAvailableStoreNames(OpenIabHelper.NAME_SAMSUNG)
.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP)
.addPreferredStoreName(OpenIabHelper.NAME_SAMSUNG)
.addStoreKeys(InAppConfig.STORE_KEYS_MAP);
mHelper = new OpenIabHelper(getApplicationContext(), builder.build());
02-06 21:52:46.247: E/AndroidRuntime(19311): FATAL EXCEPTION: main
02-06 21:52:46.247: E/AndroidRuntime(19311): java.lang.RuntimeException: Unable to start activity ComponentInfo{...MainActivity}: java.lang.IllegalArgumentException: You must supply Activity object as context in order to use com.samsung.apps store
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.app.ActivityThread.access$700(ActivityThread.java:150)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.os.Handler.dispatchMessage(Handler.java:99)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.os.Looper.loop(Looper.java:137)
02-06 21:52:46.247: E/AndroidRuntime(19311): at android.app.ActivityThread.main(ActivityThread.java:5279)
02-06 21:52:46.247: E/AndroidRuntime(19311): at java.lang.reflect.Method.invokeNative(Native Method)
02-06 21:52:46.247: E/AndroidRuntime(19311): at java.lang.reflect.Method.invoke(Method.java:511)
02-06 21:52:46.247: E/AndroidRuntime(19311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
02-06 21:52:46.247: E/AndroidRuntime(19311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
02-06 21:52:46.247: E/AndroidRuntime(19311): at dalvik.system.NativeStart.main(Native Method)
02-06 21:52:46.247: E/AndroidRuntime(19311): Caused by: java.lang.IllegalArgumentException: You must supply Activity object as context in order to use com.samsung.apps store
02-06 21:52:46.247: E/AndroidRuntime(19311): at org.onepf.oms.OpenIabHelper.checkSamsung(OpenIabHelper.java:1098)
02-06 21:52:46.247: E/AndroidRuntime(19311): at org.onepf.oms.OpenIabHelper.checkOptions(OpenIabHelper.java:1062)
02-06 21:52:46.247: E/AndroidRuntime(19311): at org.onepf.oms.OpenIabHelper.
<activity
android:name="net.example.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:label="@string/app_name" >
any idea? thank a lot!
new OpenIabHelper(getApplicationContext()
must be called with activity context, not application
if you are inside an activity, e.g. onCreate
, just pass this
as the argument
it is an activity context: public class MainActivity extends Activity tried with getApplicationContext(), and this, MainActivity.this, all cannot work.. thanks.
Please make sure error is the same. Like it clearly says in a crash log:
java.lang.IllegalArgumentException: You must supply Activity object as context in order to use com.samsung.apps store
Calling new OpenIabHelper(MainActivity.this)
from MainActivity onCreate()
method should solve at least this problem.
Unless there's something really strange going on...
Sorry, it is different. My samsung tablet has problem. It failed to upload app occasionally and hang very frequently after file transfer/connect to pc....>< Anyway, it is the different log..still failed, install with adb install -i com.sec.android.app.samsungapps /path/to/YourApp.apk
02-09 21:27:31.046: W/ResourceType(31724): Failure getting entry for 0x01080a09 (t=7 e=2569) in package 0 (error -75) 02-09 21:27:31.125: D/ray(31724): startActivityForResult() intent: Intent { cmp=com.sec.android.iap/.activity.AccountActivity } requestCode: 899 02-09 21:27:31.187: D/libEGL(31724): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 02-09 21:27:31.203: D/libEGL(31724): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 02-09 21:27:31.211: D/libEGL(31724): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so 02-09 21:27:31.289: D/OpenGLRenderer(31724): Enabling debug mode 0 02-09 21:27:31.289: D/ProgressBar(31724): updateDrawableBounds: left = 0 02-09 21:27:31.289: D/ProgressBar(31724): updateDrawableBounds: top = 0 02-09 21:27:31.289: D/ProgressBar(31724): updateDrawableBounds: right = 48 02-09 21:27:31.289: D/ProgressBar(31724): updateDrawableBounds: bottom = 48 02-09 21:27:50.000: D/ray(31724): onActivityResult() requestCode: 899 resultCode: -1 data: null 02-09 21:27:50.023: D/ray(31724): onActivityResult handled by IABUtil. 02-09 21:27:54.164: D/ray(31724): Setup finished. 02-09 21:27:54.359: D/dalvikvm(31724): GC_CONCURRENT freed 1882K, 38% free 6193K/9964K, paused 3ms+22ms, total 65ms 02-09 21:27:54.523: E/ViewRootImpl(31724): sendUserActionEvent() mView == null
02-09 21:28:27.992: D/ray(31724): Upgrade button clicked; launching purchase flow for upgrade. 02-09 21:28:27.992: E/ray(31724): **\ TrivialDrive Error: Billing Setup is not completed yet. Or it failed to setup? Please check your internet connection and then try again. 02-09 21:28:27.992: D/ray(31724): Showing alert dialog: Error: Billing Setup is not completed yet. Or it failed to setup? Please check your internet connection and then try again. 02-09 21:28:28.015: W/ResourceType(31724): Failure getting entry for 0x01080a09 (t=7 e=2569) in package 0 (error -75) 02-09 21:28:28.031: D/ProgressBar(31724): setProgress = 0 02-09 21:28:28.031: D/ProgressBar(31724): setProgress = 0, fromUser = false 02-09 21:28:28.031: D/ProgressBar(31724): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 10000 02-09 21:28:28.062: W/ResourceType(31724): Failure getting entry for 0x01080a09 (t=7 e=2569) in package 0 (error -75) 02-09 21:28:28.093: W/Choreographer(31724): Already have a pending vsync event. There should only be one at a time. 02-09 21:28:28.093: D/ray(31724): startActivityForResult() intent: Intent { cmp=com.sec.android.iap/.activity.AccountActivity } requestCode: 899 02-09 21:28:28.445: D/ProgressBar(31724): updateDrawableBounds: left = 0 02-09 21:28:28.445: D/ProgressBar(31724): updateDrawableBounds: top = 0 02-09 21:28:28.445: D/ProgressBar(31724): updateDrawableBounds: right = 48 02-09 21:28:28.445: D/ProgressBar(31724): updateDrawableBounds: bottom = 48 02-09 21:28:31.656: D/ray(31724): onActivityResult() requestCode: 899 resultCode: -1 data: null 02-09 21:28:31.679: D/ray(31724): onActivityResult handled by IABUtil. 02-09 21:28:35.914: D/ray(31724): Setup finished. 02-09 21:28:36.093: D/dalvikvm(31724): GC_CONCURRENT freed 98K, 35% free 6486K/9964K, paused 6ms+6ms, total 38ms 02-09 21:28:36.226: E/ViewRootImpl(31724): sendUserActionEvent() mView == null
Please make sure you delegate onActivityResult()
call from your activity to OpenIABHelper.
?? I guess i did it? thank
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult() requestCode: " + requestCode+ " resultCode: " + resultCode+ " data: " + data);
// Pass on the activity result to the helper for handling
if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
// not handled, so handle it ourselves (here's where you'd
// perform any handling of activity results not related to in-app
// billing...
super.onActivityResult(requestCode, resultCode, data);
}
else {
Log.d(TAG, "onActivityResult handled by IABUtil.");
}
}
I guess i did it?
Sorry, my bad. Looks like this part is fine.
So what error do you get exactly?
02-09 21:28:35.914: D/ray(31724): Setup finished.
Apparently setup listener is called correctly. So, what does it says in IabResult?
02-09 22:10:39.179: D/(23119): error.No suitable appstore was found (response: 3:Billing Unavailable)
but it called:
02-09 22:10:30.359: D/ray(23119): startActivityForResult() intent: Intent { cmp=com.sec.android.iap/.activity.AccountActivity } requestCode: 899
p.s. my config
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder()
.setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT)
.addAvailableStoreNames(OpenIabHelper.NAME_AMAZON)
.addAvailableStoreNames(OpenIabHelper.NAME_SAMSUNG)
.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP)
.addPreferredStoreName(OpenIabHelper.NAME_SAMSUNG)
.addStoreKeys(InAppConfig.STORE_KEYS_MAP);
mHelper = new OpenIabHelper(this, builder.build());
Please try adding this line before creating builder:
SamsungApps.isSamsungTestMode = true;
oh, that is a break-through...finally, I can launch it. highly suggest to add "SamsungApps.isSamsungTestMode = true;" to https://github.com/onepf/OpenIAB/wiki/How-To-support-Samsung-Apps#in-the-code
btw, when I submit the app to samsung, i should set it as false, right? thanks!
oh, that is a break-through...finally, I can launch it. highly suggest to add "SamsungApps.isSamsungTestMode = true;" to https://github.com/onepf/OpenIAB/wiki/How-To-support-Samsung-Apps#in-the-code
Ok.
btw, when I submit the app to samsung, i should set it as false, right? thanks!
Right, should be false
.
great, thank so much for your help!
Failed to pass samsungapp functional check, i.e. cannot upload app to samsung: