我已经为此问题苦苦挣扎了好几天,但似乎找不到解决方法,下面是完整的错误信息:
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2017.2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> failed to find Build Tools revision 28.0.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[
BUILD FAILED
Total time: 2.877 secs
]
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.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress 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)
这是我的gradle.build内容:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name: 'android.arch.core.runtime-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.livedata-core-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.runtime-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.viewmodel-1.1.0', ext:'aar')
compile(name: 'cardview-v7-25.3.1', ext:'aar')
compile(name: 'com.android.support.animated-vector-drawable-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.appcompat-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.asynclayoutinflater-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.cardview-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.coordinatorlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.cursoradapter-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.customtabs-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.customview-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.documentfile-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.drawerlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.interpolator-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.loader-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.localbroadcastmanager-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.percent-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.print-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.recyclerview-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.slidingpanelayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-compat-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-core-ui-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-core-utils-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-fragment-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-media-compat-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-v4-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-vector-drawable-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.swiperefreshlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.viewpager-28.0.0-alpha1', ext:'aar')
compile(name: 'com.github.vungle.vungle-android-sdk-5.3.0', ext:'aar')
compile(name: 'com.google.ads.mediation.unity-2.1.2.0', ext:'aar')
compile(name: 'com.google.ads.mediation.vungle-5.3.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-lite-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-lite-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-base-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-base-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-basement-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-basement-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gass-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gass-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gcm-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gcm-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-iid-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-iid-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-location-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-location-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-tasks-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-tasks-license-11.8.0', ext:'aar')
compile(name: 'com.sglib.easymobile.easy-mobile-1.0.2', ext:'aar')
compile(name: 'com.unity3d.ads.unity-ads-2.1.2', ext:'aar')
compile(name: 'common', ext:'aar')
compile(name: 'constraint-layout-1.0.2', ext:'aar')
compile(name: 'GoogleAIDL', ext:'aar')
compile(name: 'GooglePlay', ext:'aar')
compile(name: 'onesignal-unity', ext:'aar')
compile(name: 'percent-25.3.1', ext:'aar')
compile(name: 'unity-ads', ext:'aar')
compile project(':answers')
compile project(':beta')
compile project(':crashlytics')
compile project(':crashlytics-wrapper')
compile project(':fabric')
compile project(':fabric-init')
compile project(':GoogleMobileAdsPlugin')
compile project(':OneSignalConfig')
}
android {
compileSdkVersion 21
buildToolsVersion '28.0.0'
defaultConfig {
multiDexEnabled true
targetSdkVersion 21
applicationId 'com.chorusworldwide.upjump'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress '.unity3d', '.ress', '.resource', '.obb'
}
buildTypes {
debug {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
jniDebuggable true
}
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
}
}
}
出于某种原因,它一直将buildToolsVersion覆盖为“'28.0.0'”,即使我特别将构建设置设置为此值:
我还添加了自己的gradle.build文件到Plugin / Android中,该文件与不同的BuildToolsVersion设置为27.0.0的相同文件,但是位于项目内的Temp文件夹中的build.gradle文件仍将其重置为“28”,
最后这是我的SDK管理器的一些截图:
部分安装的Android(P)是因为这个原因(我不必全部安装吧?):
SDK工具:
更新:从构建工具中删除28.0.0-rc1之后,build.gradle开始使用版本27进行构建,但现在我收到一个新错误:
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2017.2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"
stderr[
C:\Projects\UpJump\Temp\gradleOut\build\intermediates\exploded-aar\com.android.support.appcompat-v7-28.0.0-alpha1\res\values-v28\values-v28.xml:5:5-8:13: AAPT: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\DevTools\New_SDK\build-tools\27.0.0\aapt.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]