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

发布于 2021-12-02 12:52:14 字数 10911 浏览 752 评论 1

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

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

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

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

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

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

我的导出配置:

CommandInvokationFailure: Gradle build failed. 
C:Program FilesJavajdk1.8.0_144binjava.exe -classpath "D:Unity2018.2.2f1EditorDataPlaybackEnginesAndroidPlayerToolsgradlelibgradle-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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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:worksCodeep3ep3clientMarComTempgradleOutsrcmainAndroidManifest.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()
 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恋你朝朝暮暮 2021-12-04 15:08:07

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文