unity3d 找到多个具有操作系统独立路径“META-INF/annotation-experimental_release.Kotlin_module”的文件

gab6jxml  于 2023-01-17  发布在  Kotlin
关注(0)|答案(1)|浏览(123)

我们有一个在Unity开发的游戏。最近我不得不升级一个插件。这里是问题开始的地方,因为Android现在要求你知道上传针对Android 31的应用程序。
一些细节:

  • 统一2021.1.28f1
  • 安卓软件开发包31
  • Gradle 6.1.1(Unity支持的版本)

多个插件

  • 脸书(15.1.0)
  • Firebase分析和消息传递(10.3.0)
  • 谷歌移动广告插件(v7.3.1)
  • TheoPlayer(一个插件显示广告专门为比利时)
  • 同意经理

问题出在谷歌移动广告和Theoplayer上。Theoplayer需要包com.google.ads.interactivemedia. v3:interactivemedia:3.22.2这有一个名为META-INF/annotation-experimental_release. kotlin_module的文件,谷歌移动使用的androidx. annotation:annotation-experimental:1.1.0@aar也有这个文件,所以我在构建时经常收到错误发现多个文件具有操作系统独立路径"META-INF/annotation-experimental_release. kotlin_module"。
尝试排除这个文件没有效果。我不知道如何继续,谷歌搜索也没有帮助我。这里有谁有更多的android原生编码经验谁可以进一步帮助我?我已经将我们的gradle文件附在这篇文章中。

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = path
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "Assets/GeneratedLocalRepo/Firebase/m2repository" // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22, Assets/Firebase/Editor/MessagingDependencies.xml:22
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:17, Assets/THEOplayer/Editor/THEOplayerDependencies.xml:13, Assets/THEOplayer/Editor/THEOplayerDependencies.xml:19
        }
        maven {
            url "path/ Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        maven {
            url "https://s3.amazonaws.com/moat-sdk-builds" // Assets/THEOplayer/Editor/THEOplayerDependencies.xml:7
        }
        mavenLocal()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])   
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'androidx.annotation:annotation-experimental:1.0.0'
// Android Resolver Dependencies Start
    implementation 'androidx.ads:ads-identifier:1.0.0-alpha04' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:13
    implementation 'androidx.appcompat:appcompat:1.2.0' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:7
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:11
    implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12
    implementation 'androidx.lifecycle:lifecycle-process:2.4.1' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:17
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:support-annotations:28.0.0' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:12
    implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.facebook.android:facebook-applinks:[15.1,16)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
    implementation 'com.facebook.android:facebook-core:[15.1,16)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
    implementation 'com.facebook.android:facebook-gamingservices:[15.1,16)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:9
    implementation 'com.facebook.android:facebook-login:[15.1,16)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
    implementation 'com.facebook.android:facebook-share:[15.1,16)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
    implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.22.2' // Assets/THEOplayer/Editor/THEOplayerDependencies.xml:13
    implementation 'com.google.android.gms:play-services-ads:21.4.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1' // Assets/THEOplayer/Editor/THEOplayerDependencies.xml:19
    implementation 'com.google.android.gms:play-services-base:18.1.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.code.gson:gson:2.8.6' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:9
    implementation 'com.google.firebase:firebase-analytics:21.2.0' // Assets/Firebase/Editor/MessagingDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:10.3.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:10.3.0' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-common:20.2.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-iid:21.1.0' // Assets/Firebase/Editor/MessagingDependencies.xml:17
    implementation 'com.google.firebase:firebase-messaging:23.1.1' // Assets/Firebase/Editor/MessagingDependencies.xml:13
    implementation 'com.google.firebase:firebase-messaging-unity:10.3.0' // Assets/Firebase/Editor/MessagingDependencies.xml:22
    implementation 'com.google.games:gpgs-plugin-support:0.11.01' // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
    implementation 'com.iabtcf:iabtcf-decoder:2.0.7' // Assets/ConsentManager/Editor/ConsentManagerDependencies.xml:10
    implementation 'com.moat.analytics.mobile.mpub:moat-mobile-app-kit:+' // Assets/THEOplayer/Editor/THEOplayerDependencies.xml:7
    implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
// Android Resolver Dependencies End
    implementation(name: 'billing-4.0.0', ext:'aar')
    implementation(name: 'common', ext:'aar')
    implementation(name: 'facebook-android-wrapper-15.1.0', ext:'aar')
    implementation(name: 'gameanalytics', ext:'aar')
    implementation(name: 'googlemobileads-unity', ext:'aar')
    implementation(name: 'instantapps-1.1.0', ext:'aar')
    implementation(name: 'theoplayer-android-4.6.0-minapi21', ext:'aar')
    implementation(name: 'UniWebView', ext:'aar')
    implementation project('FirebaseApp.androidlib')
    implementation project('GoogleMobileAdsPlugin.androidlib')
    implementation project('GooglePlayGamesManifest.androidlib')
    implementation project('unity-android-resources')
}    

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion 26
        targetSdkVersion 31
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 1
        versionName '1.2.9'
        consumerProguardFiles 'proguard-unity.txt'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }
}

我试过了

  • 排除2个包中的一个可以使构建成功,但是当然我缺少库,所以功能被破坏了
  • 使用不同版本的软件包,但未成功
  • 我尝试升级到Unity 2022.2,但无论如何都不起作用

我不知道为什么排除不起作用。这是否与外部库中重复文件的位置有关?
我已经导出到Android Studio并在Android Studio中修复了它。这个错误来自Android Studio环境内部。
Hierarchy where the file is

a1o7rhls

a1o7rhls1#

经过长时间的搜索和一些帮助从统一论坛我得到了这个链接:
https://socket.dev/npm/package/com.azerion.ads
在底部,他们实际上讨论了我的具体错误。排除文件仍然是解决方案,但关键是将exclude命令放在launcher.gradle文件中。Unity有一个选项可以启用此功能。这将正确地排除文件,甚至从外部库中排除文件。我希望这对大家有所帮助!

相关问题