Home » Android » Android Studio Run/Debug configuration error: Module not specified

Android Studio Run/Debug configuration error: Module not specified

Posted by: admin March 11, 2020 Leave a comment

Questions:

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
How to&Answers:

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. Remove include ':app' from the file.

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

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

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

Answer:

never mind, i changed the name in settings.gradle and synced and then changed it back and synced again and it inexplicably worked this time.

Answer:

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

Answer:

I realized following line was missing in settings.gradle file

include ‘:app’

make sure you include “:app” module

Answer:

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.

Answer:

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

Answer:

You have 3 ways:

  1. Clean Project in Android Studio menu

    Build -> Clean Project and use Build -> Rebuild


  1. Remove all modal in settings.gradle

    • Open settings.gradle project
    • Remove include ‘:app’ and and other modal
    • Sync gradle
    • Add include ‘:app’ and and other modal
    • 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

Answer:

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

Answer:

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.

Answer:

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

Answer:

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

Answer:

Remove from app gradle this code

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

Answer:

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