2016-04-28 11 views
0

コードを作成中にOutOfMemoryエラーが発生します。でコンパイルしながら、私はdexOptionを追加することができますどのように実験的なGradleプラグインでdexOptionを使用するにはどうすればよいですか?

Error:Cause:com.android.build.gradle.managed.AndroidConfig_Impl 

:私は次のエラーを取得するdexOption

model { 

    def signConf = new String() 

    android { 
     compileSdkVersion = COMPILE_SDK_VERSION as int 
     buildToolsVersion = BUILD_TOOLS_VERSION 

     defaultConfig.with { 
      applicationId = "x.y.z.k" 
      minSdkVersion.apiLevel = MIN_SDK_VERSION as int 
      targetSdkVersion.apiLevel = TARGET_SDK_VERSION as int 
      versionCode = VERSION_CODE as int 
      versionName = VERSION_NAME 
      multiDexEnabled = true 
      testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" 


     } 

     dexOptions { 
      javaMaxHeapSize "2048M" 

     } 
    } 
} 

:私はそうのように私の実験build.gradleファイルにdexOptionを追加してみました実験的なGradleプラグイン?

答えて

2

私にとっては、dexOptionsをandroid {}ブロックの外に置き、android.dexOptionという名前を付けました。

例えば、

apply plugin: 'com.android.model.application' 

model { 
    android { 
     compileSdkVersion = 23 
     buildToolsVersion = "23.0.3" 

     defaultConfig { 
      ... 
     } 

     ndk { 
      ... 
     } 

     buildTypes { 
      ... 
     } 

     productFlavors { 
      ... 
     } 
    } 
    android.dexOptions { 
     javaMaxHeapSize = "2g" 
    } 
} 

dependencies { 
... 
} 
+0

gradle-experimentalで動作することが確認されました:0.9.3 – Vladimir

関連する問題