加载chartboost插页式android错误强制关闭

时间:2014-02-14 09:25:14

标签: java android chartboost

这是我的chartboost Mainactivity.java类代码

   // Configure Chartboost
    this.cb = Chartboost.sharedChartboost();
    String appId = "52f48e072d42da4746c0d6e9";
    String appSignature = "4198d0da78055b13dc80fc937c1df8b44a498927";
    this.cb.onCreate(this, appId, appSignature, null);

    // Show an interstitial
    this.cb.showInterstitial();


@Override
protected void onStart() {
    super.onStart();

    this.cb.onStart(this);

    // Notify the beginning of a user session. Must not be dependent on user actions or any prior network requests.
    this.cb.startSession();

    // Show an interstitial
    this.cb.showInterstitial();
}



@Override
protected void onStop() {
    super.onStop();

    this.cb.onStop(this);
}

@Override
protected void onDestroy() {
    super.onDestroy();

    this.cb.onDestroy(this);
}

@Override
public void onBackPressed() {

    // If an interstitial is on screen, close it. Otherwise continue as normal.
    if (this.cb.onBackPressed())
        return;
    else
        super.onBackPressed();
}

我还在libs文件夹中包含chartboost.jar,并在gradle中添加依赖项。

dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files ('libs/jsoup-1.7.3.jar')
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
compile files('libs/chartboost.jar')
}

还在androidManifest.xml中添加活动,即

<activity android:name="com.chartboost.sdk.CBImpressionActivity"
        android:excludeFromRecents="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

但是当我启动添加它时,只显示强制关闭。 请帮我。提前完成。

1 个答案:

答案 0 :(得分:0)

我通过创建一个单独的类并在我的MainActivity.java类和所有其他类中扩展该类来解决问题,并为我工作,