[android] Android Studio Run/Debug configuration error: Module not specified

I am getting a 'Module not specified' error in my run config. I have no module showing in the drop down yet I can see my module no probs. The issue came about when I refactored my module name, changed the settings.gradle to new name.

Now when I go to project structure and select my module nothing shows in the screen, not even an error.

I'm not 100% sure, but the icon beside my module looks like a folder with a cup and not a folder with a phone.

My exact steps -

  1. Open in Android view
  2. Refactor directory name
  3. refactor module name
  4. change settings.gradle contents: name to new name

This question is related to android android-studio module gradle

The answer is


Remove from app gradle this code

android{
    defaultConfig.applicationId="com.storiebox"
}

in my case, when I added Fragment I git this error.

When I opened THe app build.gradle I saw id("kotlin-android") this plugin in plugins.

just remove it!


I realized following line was missing in settings.gradle file

include ':app'

make sure you include ":app" module


Run the app, it will show 'Edit Configuration' window. Under Module - select the app (it would be <no module> ).

Then select the activity (under Launch Options)

enter image description here


This issue also may happen when you just installed new Android studio and importing some project, in the new Android studio only the latest sdk is downloaded(for example currently the latest is 30) and if your project target sdk is 29 you will not see your module in run configuring dialog.

So download the sdk that your app is targeted, then run Sync project with gradle files.

enter image description here


You have 3 ways:

  1. Clean Project in Android Studio menu

    Build -> Clean Project and use Build -> Rebuild


  1. Remove all the modules in settings.gradle

    • Open settings.gradle project
    • Remove include ':app' and and other modules
    • Sync gradle
    • Add include ':app' and and other modules
    • Sync gradle again

  1. Remove all code in gradle.properties

    • Open gradle.properties project
    • Remove all code

      org.gradle.daemon=true

      org.gradle.configureondemand=true

      org.gradle.parallel=true

      android.enableBuildCache=true

    • Sync gradle

    • Add code again
    • Sync gradle again

We are currently recommending AS 3.3 for exercises.

These settings will work in the current 3.3 beta version with two small changes to your project:

In build.gradle (Project), change gradle version to 3.3.0-rc02

In menu go to File -> Project Structure. There you can change the gradle version to 4.10.0


None of the existing answers worked in my case (Android studio 3.5.0). I had to

  1. close all android studio projects
  2. remove the project from the recent projects in android studio wizard
  3. restart android studio
  4. use import option (Import project- Gradle, Eclipse ADT, etc) instead of open an existing project AS project
  5. File -> Sync project with gradle files

I would like to add some more information while I was facing this issue:

Ref: Answer from @Eli:

  1. Cut line include ':app' from the file.
  2. On Android Studio, click on the File Menu, and select Sync Project with Gradle files.
  3. After synchronisation, paste back line include ':app' to the settings.gradle file.
  4. Re-run Sync Project with Gradle files again.

So, let's follow the instruction and try to keep one thing in mind, that what is showing in your build configuration. Make sure you are seeing the name of your configuration app like the image below:

enter image description here

If you are seeing anything else, then the steps mentioned by @Eli (the most accepted answer) will not work.

An alternative Solution If you have a different name on the Run/Debug Configurations window and the above process is not working, please change the config name to 'app'

then -> hit Apply -> then Ok.

After that follow this:-

File->Sync project with gradle files (if needed).

Now check the issue will be resolved hopefully. I have faced this issue and I think it might help others as well.


I had the same issue after update on Android Studio 3.2.1 I had to re-import project, after that everything works


I had to select "Use classpath of module:" drop down option and choose my module.


I struggled with this because I'm developing a library, and every now and then want to run it as an application.

From app/build.gradle, check that you have apply plugin: 'com.android.application' instead of apply plugin: 'com.android.library'.

You should also have this in app/build.gradle:

defaultConfig { applicationId "com.your_company.your_application" ... }

Finally run Gradle sync.


If you can't find your settings.gradle file in your project directory

  1. Add settings.gradle file

  2. Add include ':app' inside the settings.gradle file

  3. Rebuild or sync your project

Your app module should appear in your configuration file.


Resync your project gradle files to add the app module through Gradle

  1. In the root folder of your project, open the settings.gradle file for editing.

  2. Cut line include ':app' from the file.

  3. On Android Studio, click on the File Menu, and select Sync Project with Gradle files.

  4. After synchronisation, paste back line include ':app' to the settings.gradle file.

  5. Re-run Sync Project with Gradle files again.


I was trying to open an old GitHub project with the latest android studio that's why got this error. I tried almost all the way that mentions in this post but none of them is work.

In my case, I update my Gradle version with my latest project, and the issue resolved. Use your latest Gradle version to resolve the issue.

enter image description here enter image description here


check your build.gradle file and make sure that use apply plugin: 'com.android.application' istead of apply plugin: 'com.android.library'

it worked for me


Try to delete the app.iml in your project directory and restart android studio


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to module

How to fix: fatal error: openssl/opensslv.h: No such file or directory in RedHat 7 How to import functions from different js file in a Vue+webpack+vue-loader project Typescript ReferenceError: exports is not defined ImportError: No module named tensorflow ModuleNotFoundError: What does it mean __main__ is not a package? ES6 modules in the browser: Uncaught SyntaxError: Unexpected token import module.exports vs. export default in Node.js and ES6 What's the difference between an Angular component and module Export multiple classes in ES6 modules Python - Module Not Found

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)