Skip to main content

Approaches to resolving “Module not specified” Error in Android Studio

When attempting to run or debug the application on Android Studio you can come across the error “Module not specified” in the Android Studio.  This article will outline approaches I took to get a resolution to this issue.

 

Tools

Tool Version
Android Studio Chipmunk | 2021.2.1
OS OSX - Big Sur 11.6.7
Ionic CLI 6.20.1
Node 18.0.0
Cordova cli: 11.0.0

 

Method 1 - Synchronise the project

Let's start with resynchronising the project Gradle files to add the app module through Gradle.  Use the following steps:

1. In the root folder of your project, open the settings.gradle file for editing
2. Delete the line include('app') from your file
3. Then in Android Studio, click File Menu > Sync Project with Gradle files
4. After step 3, Add again, include('app') to the settings.gradle file
5. Re-run Sync Project with Gradle files again

Re check the “Module not specified”.  Still there?  Go on to the next approach.

 

Method 2 - Import the project

Re import the project in to Android Studio

1. Close all the Android Studio projects
2. Remove the project from the recent projects in android studio wizard
3. Restart Android Studio
4. Select File > New > Import Project...
5. File > Sync project with gradle files

 

Method 3 - Clear the caches

In Android Studio clean the project and do invalidate caches/restart.  To Invalidate Caches use the following path:

File > Invalidate Caches...

Then check
Clear file system cache and Local History
Clear VCS Log caches and indexes

Finally, click Invalidate and restart

 

 

Related articles

Andrew Fletcher31 Oct 2023
Android icon not changing
If the Android app icon is not changing from the default icon (in my situation this was the Capacitor icon), here are some steps to troubleshoot and resolve the issue: Check the Icon FilesEnsure that you have provided the correct icon files in the appropriate directory. In a Capacitor project,...