How to fix 'Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:'
Solution 1
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
Solution 2
Your Gradle is out of sync. Go to: File -> Sync Project with Gradle Files
. It should fix the problem.
Solution 3
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
Solution 4
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
Solution 5
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
Related videos on Youtube
Comments
-
RAHUL UMAK over 2 years
I am trying to run a selected build variant but giving me following error in Run tab,
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: madhyapradesh-debug
So kindly suggest the solution to it.
-
Boogier over 3 yearsI wonder why every Android Studio update is so painful. I prefer to keep existing version as long as possible because of this.
-
-
b3nk4n about 4 yearsthis fix the problem I had with my LibGdx game. Thx!
-
Velda almost 4 yearsI believe this will just run the application, but without updating it. At least if it's not an instant app.
-
Bruce over 3 yearsUpdate the classpath in the Project build works for me.Thank you!
-
CoolMind over 3 yearsFile > Invalidate Cashes / Restart... helped.
-
Eric over 3 yearsAfter updating my gradle versions, I had to also
Sync Project with Gradle Files
to have it work. Thanks!! -
eng.ahmed over 3 yearsFile->Invalidate Cashes /restart-> Invalidate and restart .. worked for me .. thanks :)
-
WhiteSpidy. over 3 yearsThese questions has already similar answers. Please don't copy other's answers.
-
Sreekanth Karumanaghat over 3 yearsIt is sad that such problems keep happening now and then.
-
Mahmoud Mabrok over 3 yearsto which version
-
Naveed Ahmad over 3 yearsFile->Invalidate Cashes /restart-> Invalidate and restart worked
-
Gourango Sutradhar over 3 yearsYou saved my day!
-
cslotty about 3 yearsI have done this before and it has helped, but this time it hasn't. I had to do the gradle sync.
-
firemaples about 3 yearsPressing shift twice, searching
sync gradle
then pressing enter do the same stuff if you are lazy to move the cursor by mouse or touchpad. -
CodeToLife about 3 yearson windows Run tab->Edit config further as was said above then that plus mark appers on scroll. Also had picked up launch activity name in Launch option in advance.
-
Cooper Scott about 3 yearsMy build variant is greyed out but my device is plugged in and recognized by Android Studio
-
Andrey Aleev almost 3 yearsOnly removing .gradle folder actually helped me. Invalidate Caches / Restart, Rebuilding project had no effect
-
Zaif Senpai almost 3 yearsMy computer's power was disconnected due to an electricity issue while I was working on an android project. So I started facing this issue after that. Your answer solved my problem. Thanks!
-
Admin over 2 yearsYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-
Bhargav Thanki over 2 yearsIt worked. Thanks a lot
-
dotrinh over 2 yearsFile->Invalidate Cashes /restart-> Invalidate and restart worked well when I check very old commit in git to test
-
Mohsen Mirhoseini over 2 yearsWorkaround 1 worked by deleting the app run config and resyncing the Gradle.
-
akshay over 2 yearsFile -> Invalidate Caches / Restart -> Invalidate and restart worked for me :)
-
Tanmay Agarwal about 2 yearsworkaround 1 worked but plz can u tell me the reason behind that?? why does it works? and why it wasn't working before?
-
Bipin Gawand about 2 yearsSuberp....This should be high voted answer