使用gradle打包也可能会遇到的坑,报错如下:
CommandInvokationFailure: Gradle build failed.
D:\jdk\jdk1.8.0_191\bin\ -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0." "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> buildToolsVersion is not specified.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 37s
]
stdout[
Starting a Gradle Daemon (subsequent builds will be faster)
Parallel execution with configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the is set to a valid NDK directory. It is currently set to D:\Android_SDK\android-sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or to remove this warning.
]
exit code: 1
( psi, waitingForProcessToExit, errorMsg)
( args, workingdir, progress)
( workingdir, task, progress)
( context)
( context)
:OnGUI()
解决方案:
在模板文件的如下位置中加入:
android {
compileSdkVersion **APIVERSION**
// buildToolsVersion '**BUILDTOOLS**'
buildToolsVersion "26.0.2" //添加的代码
和可能是使用的版本过高,或者那个宏无效