1

我正在 Unity 项目 (2019.1.5f1) 上设置 Iron Source SDK(版本 6.8.4.1)及其适配器。打开应用程序时,游戏崩溃。我收到此错误(仅与 IronSource 集成):

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)

我的毕业典礼看起来像这样:

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**

我的目标 API 级别是 Android 9.0

抱歉,如果我的问题不清楚,请随时告诉我您是否需要更多信息来帮助我。

谢谢你的帮助 !

4

0 回答 0