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 Fletcher16 Aug 2022

How to handle a lost KeyStore password in Android?

If you have a situation where either you have forgotten a Keystore password or change of developers and the password wasn't sent across.... what to do?  However, your app lives on and needs to be updated!   Possible solutions grade.properties This is a great starting point....
Andrew Fletcher08 Aug 2022

How to update package.json dependencies to the latest version?

This article works through the steps to update dependencies in package.json file to the latest version. Use npm-check-updates or npm outdated to suggest the latest versions. npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all...