Android Studio duplicate entry: How to deal with xx.class related issues

1. Check whether the compileSdkVersion and buildToolsVersion of each build.gradle are consistent

Change the version number to the same

2. Add multidex configuration

Add the configuration of multiDexEnabled true in build.gradle

 
 
defaultConfig {
  multiDexEnabled true
}
  
    

Set application to android.support.multidex.MultiDexApplication in manifests
 
 
<application hardwareAccelerated="true" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name="android.support.multidex.MultiDexApplication">

3. Check build.gradle to see if there are duplicate dependencies

 
 
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'

  Just remove one of them

4. Check whether the dependent library versions of the same series are consistent

compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-database:12.0.3'
Change the following version numbers to the same version

5. Conflict between local library and online library

compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':libcocos2dx')
compile 'com.android.support:multidex:1.0.1'

The first line is the jar file in the libs folder in the corresponding path of gradle, the second line is the dependent module, you can view the gradle file corresponding to the module to view the module's dependencies, and the third line is the online library. For example, if an aa library and a bb library are compiled online, there is an aa.jar in the libs folder, and a bb.jar in the libs in the module. It is generally recommended to use an online library, so just delete aa.jar and bb.jar.


Guess you like

Origin blog.csdn.net/shaobing32/article/details/80527347