2016-05-30 16 views
10

- 在Mac OS X上運行Android 2.1.1JVM參數gradle無法在Android Studio 2.1.1的gradle.properties文件中設置

-App不在Android手機上。 gradle.properties的

內容文件

org.gradle.jvmargs=-Xmx2048M 

enter image description here

懸停時,將IDE指示它是一個未使用的屬性。它也應該是深藍色而不是灰色。

輸出:

:MyProjectDirName:transformClassesWithInstantRunSlicerForDebug 
:MyProjectDirName:transformClassesWithDexForDebug 
To run dex in process, the Gradle daemon needs a larger heap. 
It currently has approximately 910 MB. 
For faster builds, increase the maximum heap size for the Gradle daemon  
to more than 2048 MB. 
To do this set org.gradle.jvmargs=-Xmx2048M in the project 
gradle.properties. 
For more information see 
https://docs.gradle.org/current/userguide/build_environment.html 

編譯器的輸出清楚地指示它丟棄gradle.properties文件的內容。

內容的build.gradle

android { 
    dexOptions { 
     javaMaxHeapSize "2g" 
    } 
} 

與藏漢這些設置,沒有成功玩過:

enter image description here

回答

0

這個工作對我來說:

屬性文件:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

構建文件:

android { 
     ... 

     defaultConfig { 
      ... 
      multiDexEnabled true 
     } 


    dexOptions { 
     preDexLibraries = false; 
    } 
} 
+0

不幸的是,這是行不通的。 –

3

我也遇到了這個問題。沒有找到一個好的答案。這是「很好」,你可以修復它在你的本地屬性文件夾。但是那些建議必須在1人團隊中工作,或者想花時間爲每個人解決問題的人。我的團隊有一個構建服務器,這是瓶頸。

我確認了Gradle實際上正在閱讀這些項目,並且您正在閱讀的「未使用」是一個錯誤。我通過改變其中一個屬性來證實這一點

org.gradle.jvmargs=-Xmx48m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

在這一點上我得到了一個錯誤。如果它不使用此資源,那麼它不會與以下錯誤

Error:Execution failed for task ':app:mergeDebugResources'. 
GC overhead limit exceeded 
相關問題