How to fix 'Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:' How to fix 'Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:' android android

How to fix 'Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:'


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.

enter image description here


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