unity3d生成安卓apk出错,这个问题已经困扰我2个星期了

Richard_x 发布于 2018/11/21 17:26
阅读 1K+
收藏 0

本来mac下面也是有同样的问题,后面我在网上找到了解决方法。

现在用同样方法在window不起效果,我的方法是:

C:\Users\用户名\.gradle\gradle.properties里添加org.gradle.jvmargs=-Xmx3000M,目前是没有效果的!

mac目录是~/.gradle/gradle.properties

如果目录下没有需要自己添加!

windows这个问题已经困扰我2个星期了!

我的导出配置:

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Java\jdk1.8.0_144\bin\java.exe -classpath "D:\Unity2018.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':packageRelease'.
> org.gradle.tooling.BuildException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 51s
]
stdout[
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
:preBuild UP-TO-DATE
:unity-android-resources:preBuild UP-TO-DATE
:unity-android-resources:preReleaseBuild UP-TO-DATE
:unity-android-resources:checkReleaseManifest
:unity-android-resources:processReleaseManifest
:preReleaseBuild
:unity-android-resources:compileReleaseAidl
:compileReleaseAidl UP-TO-DATE
:unity-android-resources:packageReleaseRenderscript NO-SOURCE
:compileReleaseRenderscript UP-TO-DATE
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:unity-android-resources:compileReleaseRenderscript
:unity-android-resources:generateReleaseResValues
:unity-android-resources:generateReleaseResources
:unity-android-resources:packageReleaseResources
:mergeReleaseResources UP-TO-DATE
:createReleaseCompatibleScreenManifests UP-TO-DATE
:processReleaseManifest
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:95:3-74 Warning:
    Element uses-permission#android.permission.ACCESS_WIFI_STATE at AndroidManifest.xml:95:3-74 duplicated with element declared at AndroidManifest.xml:89:3-74
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:96:3-77 Warning:
    Element uses-permission#android.permission.ACCESS_NETWORK_STATE at AndroidManifest.xml:96:3-77 duplicated with element declared at AndroidManifest.xml:88:3-77
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:98:3-79 Warning:
    Element uses-permission#android.permission.WRITE_EXTERNAL_STORAGE at AndroidManifest.xml:98:3-79 duplicated with element declared at AndroidManifest.xml:91:3-79
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:99:3-73 Warning:
    Element uses-permission#android.permission.READ_PHONE_STATE at AndroidManifest.xml:99:3-73 duplicated with element declared at AndroidManifest.xml:90:3-73
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:121:3-122:21 Warning:
    Element uses-permission#android.permission.ACCESS_NETWORK_STATE at AndroidManifest.xml:121:3-122:21 duplicated with element declared at AndroidManifest.xml:96:3-77
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:124:3-125:21 Warning:
    Element uses-permission#android.permission.ACCESS_WIFI_STATE at AndroidManifest.xml:124:3-125:21 duplicated with element declared at AndroidManifest.xml:95:3-74
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:127:3-128:21 Warning:
    Element uses-permission#android.permission.CHANGE_WIFI_STATE at AndroidManifest.xml:127:3-128:21 duplicated with element declared at AndroidManifest.xml:97:3-74
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:130:3-131:21 Warning:
    Element uses-permission#android.permission.INTERNET at AndroidManifest.xml:130:3-131:21 duplicated with element declared at AndroidManifest.xml:87:3-65
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:133:3-134:21 Warning:
    Element uses-permission#android.permission.READ_PHONE_STATE at AndroidManifest.xml:133:3-134:21 duplicated with element declared at AndroidManifest.xml:99:3-73
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:139:3-140:21 Warning:
    Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:139:3-140:21 duplicated with element declared at AndroidManifest.xml:104:3-66
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:141:3-142:21 Warning:
    Element uses-permission#android.permission.BLUETOOTH_ADMIN at AndroidManifest.xml:141:3-142:21 duplicated with element declared at AndroidManifest.xml:105:3-72
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:144:3-145:21 Warning:
    Element uses-permission#android.permission.INTERNET at AndroidManifest.xml:144:3-145:21 duplicated with element declared at AndroidManifest.xml:130:3-131:21
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:146:3-147:21 Warning:
    Element uses-permission#android.permission.ACCESS_NETWORK_STATE at AndroidManifest.xml:146:3-147:21 duplicated with element declared at AndroidManifest.xml:121:3-122:21
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:148:3-149:21 Warning:
    Element uses-permission#android.permission.ACCESS_WIFI_STATE at AndroidManifest.xml:148:3-149:21 duplicated with element declared at AndroidManifest.xml:124:3-125:21
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:150:3-151:21 Warning:
    Element uses-permission#android.permission.READ_PHONE_STATE at AndroidManifest.xml:150:3-151:21 duplicated with element declared at AndroidManifest.xml:133:3-134:21
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:155:3-79 Warning:
    Element uses-permission#android.permission.ACCESS_COARSE_LOCATION at AndroidManifest.xml:155:3-79 duplicated with element declared at AndroidManifest.xml:115:3-116:21
E:\works\Code\ep3\ep3client\MarCom\Temp\gradleOut\src\main\AndroidManifest.xml:159:3-89 Warning:
    Element uses-feature#android.hardware.camera.front at AndroidManifest.xml:159:3-89 duplicated with element declared at AndroidManifest.xml:158:3-89
:splitsDiscoveryTaskRelease UP-TO-DATE
:unity-android-resources:platformAttrExtractor
:unity-android-resources:generateReleaseBuildConfig
:unity-android-resources:prepareLintJar UP-TO-DATE
:unity-android-resources:javaPreCompileRelease
:unity-android-resources:processReleaseJavaRes NO-SOURCE
:compileReleaseNdk NO-SOURCE
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:unity-android-resources:mergeReleaseShaders
:unity-android-resources:compileReleaseShaders
:unity-android-resources:generateReleaseAssets
:unity-android-resources:mergeReleaseAssets
:mergeReleaseAssets
:mergeReleaseJniLibFolders UP-TO-DATE
:unity-android-resources:compileReleaseNdk NO-SOURCE
:unity-android-resources:mergeReleaseJniLibFolders
:unity-android-resources:transformNativeLibsWithMergeJniLibsForRelease
:unity-android-resources:transformNativeLibsWithStripDebugSymbolForRelease
:unity-android-resources:transformNativeLibsWithIntermediateJniLibsForRelease
:processReleaseJavaRes NO-SOURCE
:validateSigningRelease
:unity-android-resources:mergeReleaseConsumerProguardFiles UP-TO-DATE
:unity-android-resources:transformNativeLibsWithSyncJniLibsForRelease
:unity-android-resources:mergeReleaseResources
:unity-android-resources:verifyReleaseResources
:unity-android-resources:processReleaseResources
:processReleaseResources
:generateReleaseSources
:unity-android-resources:generateReleaseSources
:unity-android-resources:compileReleaseJavaWithJavac
:unity-android-resources:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:javaPreCompileRelease UP-TO-DATE
:compileReleaseJavaWithJavac
:compileReleaseSources
:lintVitalRelease
:transformClassesWithPreDexForRelease UP-TO-DATE
:transformDexWithDexForRelease UP-TO-DATE
:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
:transformNativeLibsWithStripDebugSymbolForRelease UP-TO-DATE
:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:packageRelease
Expiring Daemon because JVM Tenured space is exhausted
Daemon will be stopped at the end of the build after running out of JVM memory
:packageRelease FAILED
50 actionable tasks: 30 executed, 20 up-to-date
Expiring Daemon because JVM Tenured space is exhausted
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <9418906d66a64af29b9472b35dfca7eb>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <9418906d66a64af29b9472b35dfca7eb>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
 

加载中
0
R
Richard_x

最新版本已经解决了,不过还没有试过,参考资料:

https://issuetracker.unity3d.com/issues/android-gradle-build-fails-when-building-project-with-asset-bundle?page=4#comments

返回顶部
顶部