Android Studio Run/Debug configuration error: Module not specified

前端 未结 16 2591
[愿得一人]
[愿得一人] 2020-12-02 07:14

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 refac

相关标签:
16条回答
  • 2020-12-02 07:29

    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.

    0 讨论(0)
  • 2020-12-02 07:31

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

    0 讨论(0)
  • 2020-12-02 07:34

    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!

    0 讨论(0)
  • 2020-12-02 07:35

    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
    0 讨论(0)
  • 2020-12-02 07:38

    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:



    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.

    0 讨论(0)
  • 2020-12-02 07:38

    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

    0 讨论(0)
提交回复
热议问题