凡是用IAP2.4,调用purchase.order 游戏崩溃。logcat报错是:
06-16 18:43:42.944: E/AndroidRuntime(8526): FATAL EXCEPTION: main06-16 18:43:42.944: E/AndroidRuntime(8526): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.xxx.xxx.com.mmiap.activity (has extras) }
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1671)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1441)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Activity.startActivityForResult(Activity.java:3464)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Activity.startActivityForResult(Activity.java:3425)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Activity.startActivity(Activity.java:3661)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.Activity.startActivity(Activity.java:3629)
06-16 18:43:42.944: E/AndroidRuntime(8526): at mm.purchasesdk.Purchase.a(Unknown Source)
06-16 18:43:42.944: E/AndroidRuntime(8526): at mm.purchasesdk.a.a(Unknown Source)
06-16 18:43:42.944: E/AndroidRuntime(8526): at mm.purchasesdk.b.handleMessage(Unknown Source)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.os.Handler.dispatchMessage(Handler.java:99)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.os.Looper.loop(Looper.java:176)
06-16 18:43:42.944: E/AndroidRuntime(8526): at android.app.ActivityThread.main(ActivityThread.java:5493)
06-16 18:43:42.944: E/AndroidRuntime(8526): at java.lang.reflect.Method.invokeNative(Native Method)
06-16 18:43:42.944: E/AndroidRuntime(8526): at java.lang.reflect.Method.invoke(Method.java:525)
06-16 18:43:42.944: E/AndroidRuntime(8526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)
06-16 18:43:42.944: E/AndroidRuntime(8526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
06-16 18:43:42.944: E/AndroidRuntime(8526): at dalvik.system.NativeStart.main(Native Method)
解决的方法,改动proj.android/AndroidManifest.xml。把从DEMO里面拷贝过来的这段:
<activity
android:name="mm.purchasesdk.iapservice.BillingLayoutActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.Translucent" >
<intent-filter android:priority="240" >
<action android:name="com.xxx.xxx.com.mmiap.activity" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
里面的
android.intent.category.LAUNCHER
改成
android.intent.category.DEFAULT
就可以。
问题源头:
<activity android:name="com.x210.intentfilters.OneActivity"android:label="oneActivity">
<intent-filter>
<actionandroid:name="myapp.action.test1" />
<actionandroid:name="myapp.action.test2" />
</intent-filter>
</activity>
<Intent-filter>节点中缺少:
<category android:name="android.intent.category.DEFAULT"/>
原因:
因为在通过Intent调用Activity时,Android默认会自己主动加入CATEGORY_DEFAULT类别属性。故在Filter配置中CATEGORY_DEFAULT是必不可少的。
參考资料:http://blog.csdn.net/andie_guo/article/details/9273755