2017-05-30 41 views
0

我一直在嘗試一個星期,並從未嘗試過在網站中的解決方案。 錯誤當前。Android Studio多個Dex文件相關性定義錯誤

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
 
> com.android.build.api.transform.TransformException: 
 
com.android.ide.common.process.ProcessException: 
 
java.util.concurrent.ExecutionException: com.android.dex.DexException: 
 
Multiple dex files define 
 
Lcom/google/android/gms/internal/zzaac$zza;

搖籃碼

apply plugin: 'com.android.application' 
 
android { 
 
    compileSdkVersion 25 
 
    buildToolsVersion "25.0.2" 
 
    defaultConfig { 
 
     //multiDexEnabled true 
 
    } 
 
    defaultConfig { 
 
     applicationId "com.oyunlar.dortislem" 
 
     minSdkVersion 15 
 
     targetSdkVersion 25 
 
     versionCode 1 
 
     versionName "1.0" 
 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
 
     //multiDexEnabled = true 
 
    } 
 
    buildTypes { 
 
     release { 
 
      //multiDexKeepProguard 'multidex-config.pro' 
 
      minifyEnabled true 
 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 
 
        'proguard-rules.pro' 
 
     } 
 
    } 
 
} 
 
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:multidex:1.0.1' 
 
    compile 'com.android.support:appcompat-v7:25.3.0' 
 
    compile 'com.google.firebase:firebase-database:10.2.0' 
 
    //compile 'com.google.firebase:firebase-core:10.0.1' 
 
    //compile 'com.google.firebase:firebase-messaging:10.0.1' 
 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
 
    //compile 'com.google.firebase:firebase-crash:10.0.1' 
 
    //compile 'com.google.firebase:firebase-ads:10.0.1' 
 
    testCompile 'junit:junit:4.12' 
 
    //compile 'com.google.android.gms:play-services:10.2.1' 
 
    //compile 'com.google.android.gms:play-services-maps:10.2.1' 
 
} 
 
apply plugin: 'com.google.gms.google-services'

AndroidManifest代碼:

<?xml version="1.0" encoding="utf-8"?> 
 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
 
    package="com.oyunlar.dortislem"> 
 
    <application 
 
     android:allowBackup="true" 
 
     android:icon="@mipmap/ic_launcher" 
 
     android:label="@string/app_name" 
 
     android:supportsRtl="true" 
 
     android:theme="@style/AppTheme1" 
 
     > 
 
     <activity android:name=".MainActivity"> 
 
      <intent-filter> 
 
       <action android:name="android.intent.action.MAIN" /> 
 
       <category android:name="android.intent.category.LAUNCHER" /> 
 
      </intent-filter> 
 
     </activity> 
 
     <activity android:name=".DortislemOyunu"></activity> 
 
     <activity android:name=".DortislemOyunuSonuc"></activity> 
 
     <activity android:name=".TopList"></activity> 
 
     <activity android:name=".NtGirisGiris"></activity> 
 
     <activity android:name=".Admin"></activity> 
 
    </application> 
 

 
</manifest>

謝謝

非常感謝。但現在最後的錯誤即將出現。 enter image description here

+0

你到底想達到什麼目的? –

回答

0

您在項目中包含所有Play服務。只添加你想要的。例如,如果你只使用地圖,然後更改

compile 'com.google.android.gms:play-services:8.1.0' 

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

從DOC:

在谷歌之前的6.5播放服務的版本,你必須編譯 整個包的API到您的應用程序。在某些情況下,這樣做使得您的應用中的方法數量(包括 框架API,庫方法和您自己的代碼)在65,536 的限制下更難以保持。

從版本6.5開始,您可以選擇性地將Google Play 服務API編譯到您的應用中。例如,只包括谷歌 飛度和Android穿戴的API,替換下面的行中的 的build.gradle文件:

編譯「com.google.android.gms:發揮服務:8.3.0」

這些行:

編譯 'com.google.android.gms:發揮服務的健身:8.3.0'
編譯「com.google.android.gms:發揮服務耐磨:8.3 .0'

或者您可以試試li柯本在應用的build.gradle:

defaultConfig { 
     ... 
     minSdkVersion 15 
     targetSdkVersion 25 
     ... 

     // Enabling multidex support. 
     multiDexEnabled true 
    } 
dependencies { 
    compile 'com.android.support:multidex:1.0.1' 
} 

在您的清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.android.multidex.myapplication"> 
    <application 
     ... 
     android:name="android.support.multidex.MultiDexApplication"> 
+0

https://drive.google。com/file/d/0B52oK9mxOU2LN29YelhSaVFidE0/view?usp =分享 –

+0

@Nurullahtayipoğlu你有沒有試過刪除應用插件行 –

+0

我還沒有刪除 –

相關問題