1

I am setting up Iron Source SDK (version 6.8.4.1) and its adapters on a Unity project (2019.1.5f1). When opening the application, the game crash. I get this error (Only with IronSource integration) :

AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
AndroidRuntime:  at com.moat.analytics.mobile.iro.k.ˋॱ(:5303)
AndroidRuntime:  at com.moat.analytics.mobile.iro.k.ʻ(:178)
AndroidRuntime:  at com.moat.analytics.mobile.iro.k.ˏ(:144)
AndroidRuntime:  at com.moat.analytics.mobile.iro.k.<init>(:81)
AndroidRuntime:  at com.moat.analytics.mobile.iro.k.ˎ(:63)
AndroidRuntime:  at com.moat.analytics.mobile.iro.j.ॱ(:108)
AndroidRuntime:  at com.moat.analytics.mobile.iro.t$5$2.ˋ(:135)
AndroidRuntime:  at com.moat.analytics.mobile.iro.t$d$2.run(:245)
AndroidRuntime:  at android.os.Handler.handleCallback(Handler.java:873)
AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:99)
AndroidRuntime:  at android.os.Looper.loop(Looper.java:193)
AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:6863)
AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

My gradle looks like this:

buildscript {
  repositories {
    google()
    jcenter()
    mavenCentral()
  }

  dependencies {
    classpath 'com.android.tools.build:gradle:3.4.2'
    classpath 'com.google.gms:google-services:4.3.0'
  }
}

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = "file:///" + file(rootProject.projectDir.path + "/../../").absolutePath
        google()
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Assets/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:20, Assets/Firebase/Editor/AppDependencies.xml:20, Assets/Firebase/Editor/RemoteConfigDependencies.xml:22
        }
        maven {
            url (unityProjectPath + "/Assets/GooglePlayGames/Editor/m2repository") // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        mavenLocal()
        jcenter()
        mavenCentral()
        flatDir {
          dirs 'libs'
        }
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.application'

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
  implementation 'com.android.support:support-v4:27.1.1'

//InMobi Adapter
  implementation 'com.android.support:appcompat-v7:27.1.1'

// Android Resolver Dependencies Start
    implementation 'com.google.auto.value:auto-value-annotations:1.6.3' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-analytics:17.0.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:6.2.1' // Assets/Firebase/Editor/AnalyticsDependencies.xml:20
    implementation 'com.google.firebase:firebase-app-unity:6.2.1' // Assets/Firebase/Editor/AppDependencies.xml:20
    implementation 'com.google.firebase:firebase-common:18.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-config:18.0.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
    implementation 'com.google.firebase:firebase-config-unity:6.2.1' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:22
    implementation 'com.google.firebase:firebase-iid:[19.0.1]' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:17
    implementation 'com.google.games:gpgs-plugin-support:0.9.64' // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
// Android Resolver Dependencies End

  **DEPS**
  implementation 'com.google.android.gms:play-services-ads:17.2.0'
}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/arm64-v8a/*' + '*')
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
  compileSdkVersion **APIVERSION**
  buildToolsVersion '**BUILDTOOLS**'

  defaultConfig {
    minSdkVersion **MINSDKVERSION**
    targetSdkVersion **TARGETSDKVERSION**
    applicationId '**APPLICATIONID**'
    ndk {
      abiFilters **ABIFILTERS**
    }
    versionCode **VERSIONCODE**
    versionName '**VERSIONNAME**'

    multiDexEnabled true
  }

  configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    all*.exclude group: 'com.android.support', module: 'support-annotations'
    all*.exclude group: 'com.android.support', module: 'support-compat'
  }

  lintOptions {
    abortOnError false
  }

  aaptOptions {
    noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
  }

**SIGN**
  buildTypes {
      debug {
      // minifyEnabled **MINIFY_DEBUG**
      // useProguard **PROGUARD_DEBUG**
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
        jniDebuggable true
      }
      release {
        // minifyEnabled **MINIFY_RELEASE**
        // useProguard **PROGUARD_RELEASE**
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
        **SIGNCONFIG**
      }
  }
**PACKAGING_OPTIONS**

}

**SOURCE_BUILD_SETUP**

My target API Level is Android 9.0

Sorry if my question is not clear, do not hesitate to tell me if you need more information to help me.

Thanks for your help !

Yelena
  • 11
  • 1
  • 2
  • try this link that has similar error https://forum.unity.com/threads/unity-android-plugin-error-java-lang-noclassdeffounderror-failed-resolution-of-java-class.344715/ –  Jul 22 '19 at 14:13
  • I'm having the same issue. I believe it's caused by Appodeal SDK. Unfortunately there is no dependencies on the "moat" in the dependency report at all. Can't find where problem comes from – ruX Sep 14 '19 at 11:05

0 Answers0