我最近開始了一個新的Android應用程序,我得到這個非常惱人的錯誤,這是避免我建立該項目。Gradle不建立在:app:mergeDebugResources失敗
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個顯示器。儘管有一些字符串和圖像,但幾乎沒有資源。爲什麼我會遇到堆內存問題?難道是因爲我有兩個android studio項目同時打開?
我使用: -Gradle版本2.10 -Android插件版本2.1.2
我已經跑了「清潔工程」,「重建工程」,「與gradle這個文件同步工程」。它沒有幫助。
非常感謝您的幫助!
可能。或者你的項目真的很大。在配置文件中增加堆大小,這是一個在其中拋出內存是正確的解決方案的情況。 –
你好@GabeSechan。我認爲這個項目不是那麼大。我剛開始它,它只有兩個活動。我不認爲這可能是項目的規模...... – FTM
同意,它聽起來不像它,除非你剛剛開始有一個小的Java堆。 –