Android Studio: Module won't show up in "Edit Configuration"

Android StudioModule

Android Studio Problem Overview


I've imported a project to Android Studio with several subprojects.

I want to run a subproject.

I successfully made this subproject's build.gradle as a module.

In order to run it, I went to Run > edit configurations > + > Android Application.

Problem: When I try to select a module, none show up in the drop down list.

Why is this?

EDIT: it shows up as a module under Groovy but not showing under Android Application. How do I get it to show up under Android Application?

Android Studio Solutions


Solution 1 - Android Studio

Make sure your build.gradle is

apply plugin: 'com.android.application'

not

apply plugin: 'com.android.library'

After you have changed, please sync your gradle again.

enter image description here

Solution 2 - Android Studio

I had similar issue when I selected parent directory of my project, I resolved by Close Project -> Delete Project from Android Studio -> Import Project by selecting right build.gradle file.

Make sure you select right build.gradle file while import.

Solution 3 - Android Studio

I fixed this by adding facets in Module settings. They were missing. right click on project > open Module settings > Facets > Add facets ( "+" sign at the top ) > Android. After adding facets you will have modules.

UPDATE:

For latest version of gradle, Facets have been removed, you can directly add modules now. right click on project > open Module settings > Add module ( "+" sign at the top ) > Phone and Tablet Application (Now you can create a new module and configure it).

Solution 4 - Android Studio

In Android Studio 3.1.2 I have faced the same issue. I resolved this issue by click on "File->Sync Project with Gradle Files".This works for me. :)

Solution 5 - Android Studio

resolved this issue by clicking on "File->Sync Project with Gradle Files"

Solution 6 - Android Studio

New project. Fixed this issue by clicking on "File->Sync Project with Gradle Files"

Solution 7 - Android Studio

I have tried all the options with no luck. So I have ended up with my working solution. Just make following steps:

  1. Close android studio if open.
  2. Copy module(project) in your current workspace.
  3. Start android studio.
  4. You will see added module in project structure.
  5. Open settings.gradle of your project and include ':YOUR_MODULE_NAME'.
  6. Sync gradle and you can see module is successfully added to your project.

Solution 8 - Android Studio

Try,

Files > Sync Project with Gradle Files or Files > Sync with File System Should do the trick.

Solution 9 - Android Studio

goto Android >> Gradle Scripts>>Build Gradle(Module :app)

make sure the first line of this file is like this.

apply plugin: 'com.android.application'

not like this

apply plugin: 'com.android.library'

Solution 10 - Android Studio

The following worked for me:

  • edit the overall project's 'settings.gradle' file and add a line at the bottom to include your new module (include ':myNewModule') - e.g:

include ':myNewModule'
  • Synch gradle.
  • Add a build.gradle file into your new module directory. You need to make sure the first line says 'apply plugin: 'com.android.application'. Simply copying a build.gradle from another module in your project, if you have one, seems to work.
  • Synch Gradle
  • Your module should now show up in 'Edit Configurations'

Solution 11 - Android Studio

This mainly happens when you copy a library project and try to build it. The solution would be to add

apply plugin: 'com.android.application'

in the build.gradle file, instead of

apply plugin: 'com.android.library'

Then do a gradle sync

Solution 12 - Android Studio

This worked for me: File > Project Structure... > Modules > Green Plus Symbol > Import > Then Select The Project

Solution 13 - Android Studio

In your module build.gradle file make sure you have the correct plugin set. it should be

apply plugin: 'android'

Solution 14 - Android Studio

No configuration was deteched because IDE was unable to detech modules (<no module>).My compileSdkVersion and buildToolsVersion was 28 in build.gradle (app module)

  android {
        .
        .
        compileSdkVersion 28
        buildToolsVersion 28
        .
        .
  }

But SDK was not installed. So then I installed it first and it worked for me !!!

enter image description here

Solution 15 - Android Studio

It appears different solutions work for difference people, for me just closing the project and importing it again resolved the problem.

Solution 16 - Android Studio

I finally figure out why the module is not showed up when I add configuration for AndroidTests for a com.android.library module.

If you include your library module in your application's build.gradle like this:

compile project(':yourlibrary')

Since for library module it is compiled with release mode by default, you can't run Android Tests for it, that's why it won't show up in the module list. I fixed it with following modification:

Add following configuration to the build.gradle of your library module:

     publishNonDefault true

By make following changes, you can debug compile your library by editing the build.gradle of your application module like following:

-    compile project(':yourlibrary')
+    debugCompile project(path: ':yourlibrary', configuration: 'debug')
+    releaseCompile project(path: ':yourlibrary', configuration: 'release')

Then sync it and you'll find it shows in the list.

Solution 17 - Android Studio

Android Studio 4+

1- File -> Close project

2- Delete .idea folder

3- Open project again

Solution 18 - Android Studio

It was fixed for me after removing and re-adding the Android and Android-Gradle Facets in the Module Settings dialog.

Solution 19 - Android Studio

I managed to fix it in Android Studio 1.3.1 by doing the following:

  1. Make a new module from File -> New -> New Module
  2. Name it something different, e.g. 'My Libary'
  3. Copy an .iml file from an existing library module and change the name of the file and rename references in the .iml file
  4. Add the module name to settings.gradle
  5. Add the module dependency in your app's build.gradle file 'compile project(':mylibrary')'
  6. Close and reopen Android Studio
  7. Verify that Android Studio recognises the module as a library (should be bold)
  8. Rename module's directory and module name by right clicking on the newly created module.
  9. Enjoy :)

Solution 20 - Android Studio

For me it was fixed by simply restarting Android Studio.. Like the good old days of Eclipse

Solution 21 - Android Studio

The following are methods to help you:

  1. Close and Open Project again
  2. Close and Open Android Studio
  3. Clean Project
  4. Rebuild Project
  5. Instantiate and Restart
  6. Make sure you have included :app
  7. Import the Project

Solution 22 - Android Studio

I added this line to my app.iml file and it works

orderEntry type="library" exported="" name="appcompat-v7-19.1.0" level="project" />

Solution 23 - Android Studio

In my case problem was from a higher (or not downloaded) compileSdkVersion and targetSdkVersion in build.gradle(app). This was happened because of cloning project in another pc that not downloaded that sdk image.

Solution 24 - Android Studio

> Sometimes the errors exists in Android-manifest because of that there > is cross like image over run/debug configuration hence try to look > over if Android-manifest has any errors in just case.

Solution 25 - Android Studio

For my case, a newbie I boogered up my project, not sure how but it would not longer run and complained about the manifest, the R, everything. I realized that some how in my settings.gradle did not have include ':app' once I added this, I was back on my way.

Solution 26 - Android Studio

Add your module in your applications .iml file like:

orderEntry type="module" module-name="yourmoudlename" exported="" 

It works for me.

Solution 27 - Android Studio

Well, nothing worked for me from all the answers. Finally, I clicked Run > Edit Configuration. On the left, u can choose a new main module and remove to deleted ones.

Solution 28 - Android Studio

If all the above doesn't work. Try to update your Android studio version. Steps:

  1. In Android Studio, select File > Settings (or Android Studio > Preference on Mac).
  2. In the left pane, select Appearance & Behavior > System Settings > Updates.
  3. Be sure that Automatically check for updates is checked, and then select a channel from the drop-down list.
  4. Click OK.

Solution 29 - Android Studio

For me it was:

  1. Right click on app project folder & select Load/Unload Modules...

  2. Select app module, click Unload >, & click OK

  3. Right click on app again & select Load/Unload Modules...

  4. Select app module, click < Load, & click OK

app then appeared for me in the configurations list again.

Solution 30 - Android Studio

  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

  5. Project AS project

  6. File -> Sync project with gradle files

Solution 31 - Android Studio

None of the previous answers worked for me, so I deleted and reinstalled Android Studio. Worked like a charm.

Solution 32 - Android Studio

In my case the problem was with SDK license acceptance. The problem was solved by downloading proper SDK version and license acceptance via SDK Manager.

Solution 33 - Android Studio

None of the above solutions worked for me.

I just upgraded the version of com.android.tools.build:gradle:7.0.0 in build.gradles to the latest version (currently 7.0.2) and it worked!

upgrading gradle dependency

Solution 34 - Android Studio

These types of problems are related to AndroidManifest.xml, so check the bugs thats are in AndroidManifest file.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1161310View Question on Stackoverflow
Solution 1 - Android StudioxDragonZView Answer on Stackoverflow
Solution 2 - Android StudioPrakashView Answer on Stackoverflow
Solution 3 - Android Studiosahil shekhawatView Answer on Stackoverflow
Solution 4 - Android StudioPankaj NegiView Answer on Stackoverflow
Solution 5 - Android StudioSubhasmith ThapaView Answer on Stackoverflow
Solution 6 - Android StudioupgoView Answer on Stackoverflow
Solution 7 - Android StudioUmeshView Answer on Stackoverflow
Solution 8 - Android StudioSonic_View Answer on Stackoverflow
Solution 9 - Android Studioakshay bhangeView Answer on Stackoverflow
Solution 10 - Android StudioMickView Answer on Stackoverflow
Solution 11 - Android StudioAkshika47View Answer on Stackoverflow
Solution 12 - Android StudioebeilmannView Answer on Stackoverflow
Solution 13 - Android StudioAaron DancygierView Answer on Stackoverflow
Solution 14 - Android StudioGk Mohammad EmonView Answer on Stackoverflow
Solution 15 - Android Studio2cupsOfTechView Answer on Stackoverflow
Solution 16 - Android StudioxfdaiView Answer on Stackoverflow
Solution 17 - Android StudioD.RosadoView Answer on Stackoverflow
Solution 18 - Android StudioTalkLittleView Answer on Stackoverflow
Solution 19 - Android StudioTim KistView Answer on Stackoverflow
Solution 20 - Android StudioYonatan NirView Answer on Stackoverflow
Solution 21 - Android StudioVaibhav KumarView Answer on Stackoverflow
Solution 22 - Android StudioBruno HaradaView Answer on Stackoverflow
Solution 23 - Android StudioMahdi MoqadasiView Answer on Stackoverflow
Solution 24 - Android StudioKOTIOSView Answer on Stackoverflow
Solution 25 - Android StudioJenniferGView Answer on Stackoverflow
Solution 26 - Android Studioren anqiView Answer on Stackoverflow
Solution 27 - Android StudioSahil PatelView Answer on Stackoverflow
Solution 28 - Android StudioViswesvar SekarView Answer on Stackoverflow
Solution 29 - Android StudioflopshotView Answer on Stackoverflow
Solution 30 - Android Studiouser13562154View Answer on Stackoverflow
Solution 31 - Android StudioG-UnitView Answer on Stackoverflow
Solution 32 - Android StudioMikhail SharinView Answer on Stackoverflow
Solution 33 - Android StudioPouya HeydariView Answer on Stackoverflow
Solution 34 - Android StudioNEERAJ GUPTAView Answer on Stackoverflow