我已将我的Google Play服务升级到0.9.53,但在Unity 2017.4.27f1和Android Studio 3.4.1上的构建均未成功。
我尝试了很多方法,但似乎找不到解决方法。使用Android Studio,我收到了另外两个具体错误。
Caused by: com.android.builder.multidex.D8MainDexList$MainDexListException: com.android.tools.r8.errors.CompilationError: Program type already present: android.support.compat.BuildConfig
Caused by: com.android.tools.r8.errors.CompilationError: Program type already present: android.support.compat.BuildConfig
这是我的Gradle mainTemplate文件以及来自Unity的错误。
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'http://repository.adincube.com/maven'
}
maven {
url 'https://ogury.bintray.com/sdk-android'
}
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.adincube.sdk:AdinCube-Unity-3626ebe:2.7.8@aar') {
transitive = true
}
implementation "com.android.support:multidex:1.0.1"
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
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**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}
**SOURCE_BUILD_SETUP**
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_211\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2017.4.27f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
]
stdout[
:checkReleaseClasspath
:preBuild UP-TO-DATE
:GooglePlayGamesManifest.plugin:preBuild UP-TO-DATE
:GooglePlayGamesManifest.plugin:preReleaseBuild UP-TO-DATE
:GooglePlayGamesManifest.plugin:checkReleaseManifest
:GooglePlayGamesManifest.plugin:processReleaseManifest
:unity-android-resources:preBuild UP-TO-DATE
:unity-android-resources:preReleaseBuild UP-TO-DATE
:unity-android-resources:checkReleaseManifest
:unity-android-resources:processReleaseManifest
:preReleaseBuild
:GooglePlayGamesManifest.plugin:compileReleaseAidl NO-SOURCE
:unity-android-resources:compileReleaseAidl NO-SOURCE
:compileReleaseAidl NO-SOURCE
:GooglePlayGamesManifest.plugin:packageReleaseRenderscript NO-SOURCE
:unity-android-resources:packageReleaseRenderscript NO-SOURCE
:compileReleaseRenderscript UP-TO-DATE
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:mainApkListPersistenceRelease UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:GooglePlayGamesManifest.plugin:compileReleaseRenderscript
:GooglePlayGamesManifest.plugin:generateReleaseResValues
:GooglePlayGamesManifest.plugin:generateReleaseResources
:GooglePlayGamesManifest.plugin:packageReleaseResources
:unity-android-resources:compileReleaseRenderscript
:unity-android-resources:generateReleaseResValues
:unity-android-resources:generateReleaseResources
:unity-android-resources:packageReleaseResources
:mergeReleaseResources
:createReleaseCompatibleScreenManifests UP-TO-DATE
:processReleaseManifest
:splitsDiscoveryTaskRelease UP-TO-DATE
:GooglePlayGamesManifest.plugin:generateReleaseRFile
:unity-android-resources:generateReleaseRFile
:processReleaseResources
C:\Users\Sogon\.gradle\caches\transforms-1\files-1.1\appnext-sdk-2.3.1.471-3.aar\2216ff231c2f864954d26d3c95094ac3\res\drawable\apnxt_ads_rating_bar.xml:3: warn: generated id 'android:id/background' for external package 'android'.
C:\Users\Sogon\.gradle\caches\transforms-1\files-1.1\appnext-sdk-2.3.1.471-3.aar\2216ff231c2f864954d26d3c95094ac3\res\drawable\apnxt_ads_rating_bar.xml:7: warn: generated id 'android:id/progress' for external package 'android'.
C:\Users\Sogon\.gradle\caches\transforms-1\files-1.1\appnext-sdk-2.3.1.471-3.aar\2216ff231c2f864954d26d3c95094ac3\res\drawable\apnxt_ads_rating_bar.xml:5: warn: generated id 'android:id/secondaryProgress' for external package 'android'.
:generateReleaseSources
:GooglePlayGamesManifest.plugin:generateReleaseBuildConfig
:GooglePlayGamesManifest.plugin:prepareLintJar UP-TO-DATE
:GooglePlayGamesManifest.plugin:generateReleaseSources
:GooglePlayGamesManifest.plugin:javaPreCompileRelease
:GooglePlayGamesManifest.plugin:compileReleaseJavaWithJavac
:GooglePlayGamesManifest.plugin:processReleaseJavaRes NO-SOURCE
:GooglePlayGamesManifest.plugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:unity-android-resources:generateReleaseBuildConfig
:unity-android-resources:prepareLintJar UP-TO-DATE
:unity-android-resources:generateReleaseSources
:unity-android-resources:javaPreCompileRelease
:unity-android-resources:compileReleaseJavaWithJavac
:unity-android-resources:processReleaseJavaRes NO-SOURCE
:unity-android-resources:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:javaPreCompileRelease
:compileReleaseJavaWithJavac
:compileReleaseNdk NO-SOURCE
:compileReleaseSources
:lintVitalRelease
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:GooglePlayGamesManifest.plugin:mergeReleaseShaders
:GooglePlayGamesManifest.plugin:compileReleaseShaders
:GooglePlayGamesManifest.plugin:generateReleaseAssets
:GooglePlayGamesManifest.plugin:packageReleaseAssets
:unity-android-resources:mergeReleaseShaders
:unity-android-resources:compileReleaseShaders
:unity-android-resources:generateReleaseAssets
:unity-android-resources:packageReleaseAssets
:mergeReleaseAssets
:transformClassesWithDexBuilderForRelease
:transformClassesWithMultidexlistForRelease FAILED
49 actionable tasks: 37 executed, 12 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)