Gradle 不要建立在 :app:mergeDebugResources 失败的基础上
Gradle don't build on :app:mergeDebugResources failure
我最近启动了一个新的 Android 应用程序,但我遇到了一个非常烦人的错误,它使我无法构建项目。
Information:Gradle tasks [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
Observed package id 'add-ons;addon-google_apis-google-23' in inconsistent location 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23-1' (Expected 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23')
Already observed package id 'add-ons;addon-google_apis-google-23' in 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23'. Skipping duplicate at 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23-1'
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library
:app:prepareComAndroidSupportAppcompatV72400Library
:app:prepareComAndroidSupportDesign2400Library
:app:prepareComAndroidSupportRecyclerviewV72400Library
:app:prepareComAndroidSupportSupportV42400Library
:app:prepareComAndroidSupportSupportVectorDrawable2400Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
java.lang.OutOfMemoryError: Java heap space
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.OutOfMemoryError: Java heap space
radle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
<em>org.gradle.jvmargs=-Xmx1024m</em>
<a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Read Gradle's configuration guide</a><br><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html">Read about Java's heap size</a>
Information:BUILD FAILED
Information:Total time: 9.513 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
问题似乎出在构建的这一部分:
:app:mergeDebugResources
java.lang.OutOfMemoryError: Java heap space
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.OutOfMemoryError: Java heap space
我刚开始使用这个应用程序。它只有两个活动和 4 个显示。尽管有一些字符串和图像,但几乎没有资源。为什么我会遇到堆内存问题?难道是因为我同时打开了 2 android 个工作室项目?
我正在使用:
-Gradle 版本 2.10
-Android 插件版本 2.1.2
我已经运行一个"clean project","rebuild project","sync project with gradle files"。没用。
提前感谢您的帮助!
我认为这是您的资源问题。
检查您在 drawable 中使用的图像大小。
减小图像的大小和分辨率,然后重建项目。
我最近启动了一个新的 Android 应用程序,但我遇到了一个非常烦人的错误,它使我无法构建项目。
Information:Gradle tasks [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugUnitTestSources, :app:compileDebugAndroidTestSources]
Observed package id 'add-ons;addon-google_apis-google-23' in inconsistent location 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23-1' (Expected 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23')
Already observed package id 'add-ons;addon-google_apis-google-23' in 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23'. Skipping duplicate at 'C:\Users\Fabio\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-23-1'
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library
:app:prepareComAndroidSupportAppcompatV72400Library
:app:prepareComAndroidSupportDesign2400Library
:app:prepareComAndroidSupportRecyclerviewV72400Library
:app:prepareComAndroidSupportSupportV42400Library
:app:prepareComAndroidSupportSupportVectorDrawable2400Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
java.lang.OutOfMemoryError: Java heap space
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.OutOfMemoryError: Java heap space
radle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
<em>org.gradle.jvmargs=-Xmx1024m</em>
<a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Read Gradle's configuration guide</a><br><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html">Read about Java's heap size</a>
Information:BUILD FAILED
Information:Total time: 9.513 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
问题似乎出在构建的这一部分:
:app:mergeDebugResources
java.lang.OutOfMemoryError: Java heap space
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.OutOfMemoryError: Java heap space
我刚开始使用这个应用程序。它只有两个活动和 4 个显示。尽管有一些字符串和图像,但几乎没有资源。为什么我会遇到堆内存问题?难道是因为我同时打开了 2 android 个工作室项目?
我正在使用: -Gradle 版本 2.10 -Android 插件版本 2.1.2
我已经运行一个"clean project","rebuild project","sync project with gradle files"。没用。
提前感谢您的帮助!
我认为这是您的资源问题。 检查您在 drawable 中使用的图像大小。 减小图像的大小和分辨率,然后重建项目。