0

これが私の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" />

しかし、追加を起動すると、強制終了が表示されます。私を助けてください。事前にサンクス。

4

1 に答える 1

0

別のクラスを作成し、そのクラスを MainActivity.java クラスと他のすべてのクラスでも拡張することで問題を解決しました。

于 2014-04-08T14:02:24.683 に答える