2017-04-12 93 views
0

我目前正在開發一個自定義主題版本的谷歌地圖,並花了過去上帝知道多久試圖解決此構建錯誤。我對此進行了廣泛的研究,發現似乎無助於解決我的問題。谷歌地圖Android應用程序生成錯誤:應用程序:transformClassesWithDexForDebug

我已經包含下面

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.wtwelectronics.googlemapsrev2" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
//   Enabling multidex support. 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dexOptions { 
     incremental true 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.google.android.gms:play-services:10.2.1' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:design:25.3.1' 
    testCompile 'junit:junit:4.12' 
} 

的gradle這個控制檯輸出的第一個錯誤行我的應用程序/文件的build.gradle低於:

Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process 

我採用了android 2.3.1工作室,與最新的SDK包等。

在此先感謝。

+0

您是否嘗試過清潔和再次建築? –

+0

可能是'google-services.json'丟失 –

+0

構建 - > make項目/ clean項目/重建全部成功完成,我已經嘗試了一百萬次,這個問題只出現在android工作室試圖建立一個apk文件。 – wtw

回答

0

嘗試在gradle這個

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

添加該看看this例子更多。

+0

,你也必須把你的JSON放到app文件夾中。只需複製並粘貼在那裏。 – Simo

+0

好的,試過了,得到了完全相同的錯誤。忙着看着json文件的東西。謝謝您的幫助。 – wtw

+0

@wtw您需要用此替換現有的Google服務行,而不是添加 –

相關問題