2017-05-30 43 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

我还没有删除 –

相关问题