Search code examples
javascriptangularjsionic-frameworkchartboost

app crash when i run window.chartboost.setup( appId,appSignature ) with ionic


After i re-test and re-test again, now i managed to scope down my problem. What i want to achieve is to run chartboost ads in my ionic apps, but i'm facing this problem.

.controller('chapter1Ctrl', ['$scope', '$stateParams', 
function ($scope, $stateParams) {
    $scope.appId = "xxxxxxxxxxxx";
    $scope.appSignature = "xxxxxxxxxxxxxxxxxxxx";

    $scope.testobject = function() {

        alert("window.chartboost :"+ window.chartboost );
     }

    $scope.preloadads = function() {

       if( window.chartboost )
        {
          window.chartboost.setUp($scope.appId, $scope.appSignature);
          window.chartboost.preloadInterstitialAd('Default');         
        }
     }

     $scope.showads = function() {

       if( window.chartboost )
        {
            window.chartboost.showInterstitialAd('Default');
        }
     }

}])

To troubleshoot it, i have created 3 buttons (testobject , prelaod, showads ). After i run testobject, it shows [Object object] seems like i can reach the plugin that i have installed. Then when i run the second button "preload" the apps crash, i guess it crash because of running the method "window.chartboost.setup". I really have no clue here, i really need some help is anyone faced this problem and know the solution?


Solution

  • I found the error message in logcat

    "java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient"

    I solved it by just installing the google play services plugin.