root电话上的google Ads异常:InAppPurchaseActivity中的RuntimeException

时间:2016-12-23 18:34:30

标签: android

Fabric在几个小时前报道了这一消息 - 由一部根电话(“Batmobile”XT320运行Android 4.3.1)报道

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{my.android.awesome/com.google.android.gms.ads.purchase.InAppPurchaseActivity}: java.lang.NullPointerException
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
       at android.app.ActivityThread.access$600(ActivityThread.java:141)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5103)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.NullPointerException
       at com.google.android.gms.ads.internal.purchase.zze.onCreate(Unknown Source)
       at com.google.android.gms.ads.purchase.InAppPurchaseActivity.onCreate(Unknown Source)
       at android.app.Activity.performCreate(Activity.java:5133)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
       at android.app.ActivityThread.access$600(ActivityThread.java:141)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5103)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
       at dalvik.system.NativeStart.main(NativeStart.java)

问题是,我的应用不支持IAP!

依赖项列表:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.android.support:cardview-v7:25.0.1'
    compile 'com.android.support:recyclerview-v7:25.0.1'
    compile 'com.google.android.gms:play-services-ads:10.0.1'//skip 9.6.0 due to permissions bug
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.android.support:design:25.0.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true;
    }
}

XML中的广告实现:

<com.google.android.gms.ads.AdView
    android:id="@+id/adViewBanner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    app:adSize="BANNER"
    app:adUnitId="@string/ad_id_main_screen">
</com.google.android.gms.ads.AdView>

并且广告加载代码:

protected void onCreate(@Nullable Bundle savedInstanceState)
{
    Log.d("ScreenCreated", getClass().getSimpleName());

    // Data Binding
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    // Ads
    AdRequest adRequest = new AdRequest.Builder()
            //.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
    binding.adViewBanner.loadAd(adRequest);

我该怎么做才能防止奇怪的异常? 根电话与Google广告的搭配是否正常?

0 个答案:

没有答案