2015-11-04 43 views
-1

我在關注此鏈接https://developers.google.com/admin-sdk/directory/v1/quickstart/android以使用Google目錄API。我是android開發新手,並遵循那裏的步驟。最後,在運行的應用程序,我得到這個錯誤:在Android應用中實現Google目錄API

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 2

我通過把multiDexEnabled truedefaultConfig在應用級的build.gradle固定它。接下來,當我嘗試運行該應用程序時,花了大約10分鐘後它就失去了內存。下面是完整的日誌:

:app:dexDebug Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space 3 errors; aborting Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1 Information:BUILD FAILED Information:Total time: 9 mins 46.138 secs Information:1 error Information:0 warnings Information:See complete output in console

這裏是我的應用級的build.gradle:

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 
    defaultConfig { 
     applicationId "com.google.samples.quickstart.signin" 
     minSdkVersion 18 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'LICENSE.txt' 
    } 
    // Resolve dependency differences between app and tests 
    configurations.all { 
     resolutionStrategy.force 'com.android.support:support-annotations:22.2.0' 
    } 
    productFlavors { 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
    compile 'com.google.android.gms:play-services-plus:8.1.0' 
    // UiAutomatorTesting 
    androidTestCompile 'com.android.support.test:runner:0.2' 
    androidTestCompile 'com.android.support.test:rules:0.2' 
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0' 
    androidTestCompile 'com.android.support:support-annotations:23.0.1' 
} 

我在做什麼錯?

回答

0

添加

android { 
    dexOptions { 
     javaMaxHeapSize "4g" 
    } 
} 

到的build.gradle使代碼工作,因爲我們增加了堆的最大尺寸。