Android Studio-No Module

AndroidAndroid Studio

Android Problem Overview


I am new to Android Studio.This is my project screenshot.My project builds successfully but when i run it only Build Successful is shown.enter image description here
By what I understand I think where build is written in the toolbar there should be my project name.When I go to Edit Configuration inside Module there is only one option that is No Module while I think my project name should be there.When I right click on my project and click on Make Module 'Copy of IBL2 eclipse' nothing happens.This project was running fine in eclipse.

Android Solutions


Solution 1 - Android

Try first in Android Studio:

File -> Sync Project with Gradle Files

Solution 2 - Android

In the "project" page on the top left corner in android studio.

From dropdown 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 3 - Android

Go to Project setting enter image description here

CHECK if the project setting is like this,if the module that you want is show in here enter image description here

IF the module that you want or "Module SDK" is not show or not correct.

then go to the module's build.gradle file to check if the CompileSdkVersion has installed in your computer.

or modifier the CompileSdkVersion to the version that has been installed in your computer.

In my case:I just installed sdk version 29 in my computer but in the module build.gradle file ,I'm setting the CompilerSdkVersion 28

Both are not matched.

Modifier the build.gradle file CompilerSdkVersion 29 which I installed in my computer

It's working!!!

enter image description here enter image description here

Solution 4 - Android

If you have imported the project, you may have to re-import it the proper way.
Steps :

  1. Close Android Studio. Take backup of the project from C:\Users\UserName\AndroidStudioProjects\YourProject to some other folder . Now delete the project.
  2. Launch Android Studio and click "Import Non-AndroidStudio Project (even if the project to be imported is an AndroidStudio project).
  3. Select only the root folder of the project to be imported. Set the destination directory. Keep all the options checked. AndroidStudio will prompt to make some changes, click Ok for all prompts.
  4. Now you can see the Module pre-defined at the top and you can launch the app to the emulator.

Tested on AndroidStudio version 1.0.1

Solution 5 - Android

For some reason, I was missing the settings.gradle file.

  1. Create settings.gradle under your root directory, and inside it:
include ':app'

(assuming your app is indeed inside /app directory).

  1. Hit File -> Sync Project with Gradle Files.


After that everything worked out for me.

Solution 6 - Android

Other path is " tool menu-->android-->sync proyect with gradle File"

Solution 7 - Android

I was able to resolve this issue by performing a Gradle sync

To do this:

  1. In project view, right click the root (in my example below, "JamsMusicPlayer"

  2. Click "Synchronize {ProjectName}"

  3. Once this completes, you should see a module in your "Run" dialog

Gradle sync

Solution 8 - Android

In my case, 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 9 - Android

enter image description here

For those of you who are visual learners here is another place to look for the fix. I did indeed find that the underlined tag was pointing to "library" and a change to "application" and then updating gradle got my project running on the emulator.

Solution 10 - Android

Sometimes the following fix will work. Go to your build.gradle of your project and add google() into the repositories element and google() should be the at the top of all the repository.

This is the sample of the repositories block. What you need to do is to add google() or if that exists already, take that to the top of all the line inside repositories

    repositories {
    google()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.google.com' }
}

Solution 11 - Android

Check for the file gradle.properties in your project root folder. If not there, create a new file with the name / copy the file from other project.

Open and check both the build.gradle file and confirm you have have any error in those files.

Then, Click on the File menu -> Sync project with Gradle Files.

Solution 12 - Android

For me the sdk version mentioned in build.gradle wasn't installed. Used SDK Manager to install the right SDK version and it worked

Solution 13 - Android

In my case, the project use older version of Gradle (3.3) and in new version of Android Studio that not work as usual

So i add google repo in the build.gradle, then everything goes right

repositories {
   google() // if google() not work, use below instead
   // maven { url 'https://dl.google.com/dl/android/maven2/' }
   jcenter()
}

Solution 14 - Android

I had this problem, and was able to resolve it by updating the Android Gradle Plugin and Gradle version in my installation. I updated by going to File > Project Structure > Project menu and using the dropdown boxes. I've included a picture of this menu below. For more information, see the android developer website gradle plugin page.

Once the plugin and gradle version were updated, a gradle sync was able to complete successfully, and the app module appeared under build configurations.

Project Structure, Project Menu

Solution 15 - Android

I had a similar issue of my app module disappearing, this was after a large merge (from hell). I found app.iml was missing <component name="FacetManager"> when compared with other projects and before the merge. So I copy and pasted the below under the root <module > element.

Manually editing the .iml files maybe ill advised so proceed at your own risk.

File: project root folder > app > app.iml

Add the following...

  <component name="FacetManager">
    <facet type="android-gradle" name="Android-Gradle">
      <configuration>
        <option name="GRADLE_PROJECT_PATH" value=":app" />
      </configuration>
    </facet>
    <facet type="android" name="Android">
      <configuration>
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
        <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
        <afterSyncTasks>
          <task>generateDebugSources</task>
        </afterSyncTasks>
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res" />
        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
      </configuration>
    </facet>
  </component>

Solution 16 - Android

I had the same issue since I changed my app ID in config.xml file.

I used to open my Android project by choosing among recent projects of Android Studio.

I just File > Open > My project to get it working again.

Solution 17 - Android

I had the same issue when using Kotlin DSL. The project level build.gradle.kts file seemed to be causing problems in that Android Studio could not detect it. What solved this for me was:

Rename build.gradle.kts -> build.gradle
File -> Sync Project with Gradle Files
Rename build.gradle -> build.gradle.kts

Hope it helps.

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
QuestionAndroid DeveloperView Question on Stackoverflow
Solution 1 - AndroidIngoView Answer on Stackoverflow
Solution 2 - Androidakshay bhangeView Answer on Stackoverflow
Solution 3 - AndroidlinjiejunView Answer on Stackoverflow
Solution 4 - AndroidvinView Answer on Stackoverflow
Solution 5 - AndroidA. KaliView Answer on Stackoverflow
Solution 6 - Androidedward perinesView Answer on Stackoverflow
Solution 7 - AndroidCody MaustView Answer on Stackoverflow
Solution 8 - AndroidGk Mohammad EmonView Answer on Stackoverflow
Solution 9 - AndroidJesseBoydView Answer on Stackoverflow
Solution 10 - AndroidShoaib AhmedView Answer on Stackoverflow
Solution 11 - AndroidLogoView Answer on Stackoverflow
Solution 12 - AndroidthehellmakerView Answer on Stackoverflow
Solution 13 - AndroiddjzhaoView Answer on Stackoverflow
Solution 14 - AndroidTylerView Answer on Stackoverflow
Solution 15 - AndroidscottyabView Answer on Stackoverflow
Solution 16 - AndroidA. D'AlfonsoView Answer on Stackoverflow
Solution 17 - AndroidRidhwaanView Answer on Stackoverflow