Dex error On Android Studio 3.0 Beta4
I have same problem with Android Studio 3.0 beta 4. I found a solution.
1. From the Build
menu, press the Clean Project
button.
2. After task completed, press the Rebuild Project
button from the Build
menu.
For Android Studio 3.0 what I did was to add this to my gradle:
multiDexEnabled true
And it worked!
Example
android { compileSdkVersion 25 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.xx.xxx" minSdkVersion 15 targetSdkVersion 24 versionCode 9 versionName "1.0" multiDexEnabled true //Add this testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { shrinkResources true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } }}
So I solved this issue by doing the following:
- Delete the
./gradle
folder inside your project - Delete all the build folders and the gradle cache. I ran the following command:
How ?
cd ~/[your project root folder] && find . -name build -exec rm -rf {} \; && rm -rf $HOME/.gradle/caches/
Assuming your gradle config files are in the $HOME/.gradle
folder.
- Inside Android Studio, went to
File > Invalidate caches / Restart...
and invalidated the caches and restarted it.