I have Android Studio Beta. I created a new project with compile my old modules but when I tried launching the app it did not launch with the message:
Error:
if(1. Try to clean and rebuild work ) then good
else if (2. Try to remove gradle work ) then good
else-> 3. Try to add in grade.properties
android.enableD8 = false
else-> 4. Add multiDexEnabled
true to your build.gradle
android {
compileSdkVersion 26
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
...
}
}
and add the dependency
dependencies {
compile 'com.android.support:multidex:1.0.1'}
It may the first one works for u and so on but it really depends on the nature of your problem for me for example
I got the error once I have added this library
implementation 'com.jjoe64:graphview:4.2.2'
and later I discovered that I have to check that and I have to add the same version of the support libraries. So I have to try another version
compile 'com.jjoe64:graphview:4.2.1'
and it fixes the problem. So pay attention for that.
For our project, we accidentally added same jar two times with different name. Removing one of them solved the issue.
In my case a library makes this problem, library was successfully added to project but when i run my app it shows me this error. So if this happens to you too, you can go to github and check issues or raise new issue. If you do not find any solution regarding the library i suggest you to replace it.
Hi I have same issue tried almost everything. So, finally i resolved after 6 hour long struggle by debugging everything line by line.
classpath 'com.google.gms:google-services:3.0.0'
Google-services 3.0 Doesn't support firebase with Studio 3.0 with playServiceVersion: 11.6.0 or less.
implementation "com.google.firebase:firebase-messaging:$rootProject.ext.playServiceVersion"
implementation "com.google.firebase:firebase-core:$rootProject.ext.playServiceVersion"
implementation "com.firebase:firebase-jobdispatcher-with-gcm-dep:$rootProject.ext.jobdispatcherVersion"
Solution :
I have change google services to
classpath 'com.google.gms:google-services:3.1.1'
And it support firebase services.
Hopefully somebody save his/her time.
Delete the .gradle
directory.
Run your app again.
Notes
.gradle
directory is in your project's root folder. (You may have to show hidden files first.) Enable
defaultConfig { multiDexEnabled true }
If step 1 doesn't work then
Go to project structure and find out the external library which is using a different version. Double click on it and delete its jar file. Close the project and open again android studio will rebuild the project. The problem should be gone.