First clean your project by
Build -> Clean project
Then rebuild project
Build -> Rebuild project
Then run your project. I hope this will work.
if not then go to
File -> Invalidate Caches / Restart -> Invalidate and restart
The last option is you can sync Gradle again in case nothing worked
Your Gradle is out of sync. Go to: File -> Sync Project with Gradle Files
. It should fix the problem.
This is because your gradle version in project build.gradle configuration is too old for a newer Android Studio version, like Android Studio 3.6.1,
1. you should change the gradle configuration into a newer one under: build.gradle(project)->buildscript->dependencies->classpath;
for example, you should change:
classpath 'com.android.tools.build:gradle:2.3.1'
into:
classpath 'com.android.tools.build:gradle:3.1.2'
2. after this, may be you should also change the configuration in gradle-wrapper.properties into a newer version, for example, change:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
into:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
3. after this, may be you should also add google()
at:
build.gradle(project)->buildscript->repositories
and
build.gradle(project)->allprojects->repositories
I have the same issue with a Cordova Project after I updated Android Studio to 3.6.1
As a workaround (at least for the first installation of the app) I use installDebug Gradle Task from Gradle Tab View -> Tasks -> Install
I faced this problem today.
Select nothing from the installation option and click on the add icon button. Select Run Gradle task.
Double click on the run Gradle task and there will be a pop-up option like the image. Change the first option to the app and the second option to install debug like the image.
Now finally you solved the problem
For me the solution was apparently to update the Gradle plugin...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With