javaandroidchartboost

Android Chartboost SDK Error


I have the next error with my app with Chartboost sdk integrated: my app runs fine and show static and video interstitial, I can launch my app several times and always ads show fine but when exit the app and with Android recents button if I close my app then my app crashes on launch (I initialize the Chartboost SDK on Main activity app launch) but if I quit Chartboost sdk then this behaviour does not happen. Does the same thing happen to your apps? see image bellow, thanks.

Eclipse error log:

    FATAL EXCEPTION: main
Process: com.ticogames.relaxing.help, PID: 21839
java.lang.NoSuchMethodError: No static method       checkSelfPermission(Landroid/content/Context;Ljava/lang/String;)I in class     Landroid/support/v4/content/ContextCompat; or its super classes (declaration    of 'android.support.v4.content.ContextCompat' appears in /data/app   /com.ticogames.relaxing.help-1/base.apk)
at com.moat.analytics.mobile.cha.n.ͺ(SourceFile:5303)
at com.moat.analytics.mobile.cha.n.ʽ(SourceFile:178)
at com.moat.analytics.mobile.cha.n.ˎ(SourceFile:144)
at com.moat.analytics.mobile.cha.n.<init>(SourceFile:81)
at com.moat.analytics.mobile.cha.n.ˏ(SourceFile:63)
at com.moat.analytics.mobile.cha.f.ˎ(SourceFile:108)
at com.moat.analytics.mobile.cha.t$2$2.ˏ(SourceFile:135)
at com.moat.analytics.mobile.cha.t$d$5.run(SourceFile:245)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)

Eclipse Error log - Image


Solution

  • the error message refers to the support libraries, which would need to be >= version 23.0.0. this issue can be fixed with the module-level build-gradle and these dependencies:

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    

    and you'd have to implement the below methods, in order to forward the interface methods:

    @Override
    public void onStart() {
        super.onStart();
        Chartboost.onStart(this);
    }
    
    @Override
    public void onResume() {
        super.onResume();
        Chartboost.onResume(this);
    }
    
    @Override
    public void onPause() {
        super.onPause();
        Chartboost.onPause(this);
    }
    
    @Override
    public void onStop() {
        super.onStop();
        Chartboost.onStop(this);
    }
    
    @Override
    public void onDestroy() {
        super.onDestroy();
        Chartboost.onDestroy(this);
    }
    
    @Override
    public void onBackPressed() {
        // If an interstitial is on screen, close it.
        if (Chartboost.onBackPressed()) {
            return;
        } else {
            super.onBackPressed();
        }
    }
    

    here it is basically all explained in detail ...eg. Android API level 27 is not yet being support - therefore API level 26 is the maximum level available (but one can still use those 27.1.1 support libraries).

    In every case, the stack-trace and the error description do not match, at all.