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 10 months
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 about 2 yearsI wonder why every Android Studio update is so painful. I prefer to keep existing version as long as possible because of this.
-
-
b3nk4n over 2 yearsthis fix the problem I had with my LibGdx game. Thx!
-
Velda over 2 yearsI believe this will just run the application, but without updating it. At least if it's not an instant app.
-
Bruce about 2 yearsUpdate the classpath in the Project build works for me.Thank you!
-
CoolMind about 2 yearsFile > Invalidate Cashes / Restart... helped.
-
Eric about 2 yearsAfter updating my gradle versions, I had to also
Sync Project with Gradle Files
to have it work. Thanks!! -
eng.ahmed about 2 yearsFile->Invalidate Cashes /restart-> Invalidate and restart .. worked for me .. thanks :)
-
WhiteSpidy. about 2 yearsThese questions has already similar answers. Please don't copy other's answers.
-
Sreekanth Karumanaghat about 2 yearsIt is sad that such problems keep happening now and then.
-
Mahmoud Mabrok about 2 yearsto which version
-
Naveed Ahmad almost 2 yearsFile->Invalidate Cashes /restart-> Invalidate and restart worked
-
Gourango Sutradhar almost 2 yearsYou saved my day!
-
cslotty over 1 yearI have done this before and it has helped, but this time it hasn't. I had to do the gradle sync.
-
firemaples over 1 yearPressing 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 over 1 yearon 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 over 1 yearMy build variant is greyed out but my device is plugged in and recognized by Android Studio
-
Andrey Aleev over 1 yearOnly removing .gradle folder actually helped me. Invalidate Caches / Restart, Rebuilding project had no effect
-
Zaif Senpai over 1 yearMy 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 1 yearYour 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 about 1 yearIt worked. Thanks a lot
-
dotrinh about 1 yearFile->Invalidate Cashes /restart-> Invalidate and restart worked well when I check very old commit in git to test
-
Mohsen Mirhoseini 10 monthsWorkaround 1 worked by deleting the app run config and resyncing the Gradle.
-
akshay 10 monthsFile -> Invalidate Caches / Restart -> Invalidate and restart worked for me :)
-
Tanmay Agarwal 10 monthsworkaround 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 7 monthsSuberp....This should be high voted answer