2017-01-03 50 views
0

當我開發包含谷歌地圖,所以我跟着谷歌頁面的指令的應用https://developers.google.com/maps/documentation/android-api/start谷歌地圖API和異常運行的應用程序

當我同步的文件,一切工作正常,但每次我嘗試運行它,我得到了一個異常說:

Error:Execution failed for task 

':app:transformClassesWithDexForDebug'. 
    > com.android.build.api.transform.TransformException: 
    com.android.ide.common.process.ProcessException: 
    org.gradle.process.internal.ExecException: 
    Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' 
    finished with non-zero exit value 3 

這是我的gradle這個

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.example.tellme.mapwithmarker" 
     minSdkVersion 18 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.android.support:multidex:1.0.0' 
} 

聯合國直到現在,項目中沒有任何東西需要地圖片段和主要的Java類。

我將不勝感激任何幫助解決這個錯誤。

謝謝。

回答

0

而是在項目中使用的所有播放服務的,使用必需的一個。

使用 編譯 'com.google.android.gms:發揮服務,地圖:10.0.1'

代替

編譯「com.google.android.gms:發揮服務: 10.0.1'

參考鏈接: https://developers.google.com/android/guides/setup

+0

非常感謝,我的問題在我使用您的解決方案時得到了解決。 – Lolowh

0

下面buildTypes的gradle中添加此

dexOptions { 
    // incremental true 
    javaMaxHeapSize "4g" 

} 
+0

檢查 –

+0

第一次需要 –

0

您需要更改

`compile 'com.google.android.gms:play-services:10.0.1'` 

`compile 'com.google.android.gms:play-services-maps:10.0.1'` 

使用下面搖籃文件,它會正常工作我已經使用這個需要時間來編譯和運行應用程序在我身邊

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 

     applicationId "com.example.tellme.mapwithmarker" 

     minSdkVersion 18 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    // compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.android.gms:play-services-maps:10.0.1' 
    compile 'com.android.support:multidex:1.0.0' 
} 
+1

非常感謝。 – Lolowh