I recently try to open up a project developed sometime ago into Android Studio and try to rebuild it and I get whole load Android Pre Dex errors which I am totally stuck how I get rid of them. Tried a lot of stuff such as changing Android API level, cleaning, change jdk version.. all doesn't work.
Any experts out there can enlighten me what is the likely cause of these errors.?
android pre dex errors screenshot
Step 1: Add multidex enabled in default config
defaultConfig {
applicationId "Your package name"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName '1.0.5'
multiDexEnabled true
}
Step 2 : Add this library in your dependencies
compile 'com.android.support:multidex:1.0.0'
Step 3 : Add this line in your MyApplication extends Application java class
MultiDex.install(this);
Step 4: Don't forgot to call MyApplication class in your Application tag of manifest file. Like this
android:name=".MyApplication"
After this 4 steps clean your project and run the application. Surely it will helps you!
Happy Coding!
i already solved it
it happen because you didnt setting the default java in android studio 2.3.3 or android studio 3.0 beta 6
- go to file > project structure > SDK location
- change the JDK Location to C:\Program Files\Java\jdk1.8.0_131