unity3d - 在统一 2017.4.17 中构建 android 和构建应用程序包中的这个错误是什么?
问题描述
在 Unity 2017.4.17 中构建 android 时出现一些错误
我对 unity 5.3.4p3 没有问题,但 google play 不接受我的游戏并且它需要 x64,所以我更改为 unity 2017.4.17 并在 gradle 中并点击构建应用程序包(google play)但我有错误
** 我在电脑上安装了一些统一版本:unity 5.3.4p3,unity 5.4.0.3,unity 2017.4.17,unity 2018.2.18,unity 2018.2.15,unity2017.4.28,unity 2017.4.29,unity 2019.1.2,unity 2019.1.5 但它不起作用...请帮帮我...帮帮我
我附加了错误
这个错误是
gradle build failed 详情见控制台
我在统一 2019.1.5 中也遇到了这个错误
请帮我
我在这个错误中已经 30 天了,不能越过它谢谢
我在下面写了错误:
CommandInvokationFailure:Gradle 构建失败。C:/Program Files/Java/jdk1.8.0_192\bin\java.exe -classpath "F:\files\pc\Video\artoon\program files\UnitySetup64-2017.4.17f1\Unity\Editor\Data\PlaybackEngines\AndroidPlayer \Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"
标准错误[
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.3.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom'.
> jcenter.bintray.com
* 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 32s
]
stdout[
Starting a Gradle Daemon (subsequent builds will be faster)
]
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)
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
这是 UnitySetup64-2017.4.17f1>Unity>Editor>Data>PlaybackEngines>AndroidPlayer>Tools>GradleTemplates 中的 mainTemplate 文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
defaultConfig {
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
}
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**```
解决方案
我解决了这个问题,只需Gradle
在播放器设置中选择 Minify release
- 进入播放器设置
- 向下滚动
- 见发布设置
- 见缩小
- 选择发布 (
Gradle
) 和调试 (Gradle
) 一切都会好的