Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find module with Gradle path. Linking to library -unspecified instead

Update 2 This has been fixed in Android Studio 1.2 Beta 3

Update: This has reportedly been fixed in an upcoming release of Android Studio.

In Android Studio 1.2 Beta 2 I started getting the following warnings when syncing Gradle.

Failed to set up dependencies Warning:Unable to find module with Gradle path ':Library1'. Linking to library 'Library1-unspecified' instead. Warning:Unable to find module with Gradle path ':Library2'. Linking to library 'Library2-unspecified' instead. 

I've noticed that jumping to a declaration declared in one of the library modules pulls up the Decompiler instead of just going to the actual source in the library module.

In my Android Studio Project I have the following modules:

- App - Library1 - Library2 

Module: App build.gradle snippet:

dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile project(':Library1')     compile project(':Library2') } 

settings.gradle file:

include ':App' include ':Library1' include ':Library2' project(':Library1').projectDir = new File(settingsDir, '../library1/lib') project(':Library2').projectDir = new File(settingsDir, '../Library2/lib') 
like image 337
Ryan R Avatar asked Apr 10 '15 16:04

Ryan R


1 Answers

I faced this with Android Studio 2.2.3. The problem was with the .iml file that was causing the problem.

After importing the module folder into the project directory and adding the changes to include module in settings.gradle, delete the .iml file from the module folder and do a Gradle Sync. Then right click on any module in the Project Window and click on "Configure Project Subset...", if the imported module is not checked, check it and Android Studio should do a Gradle Sync. By then the imported module will appear in the Project Window and will have a .iml file regenerated that is does not cause any issues.

like image 178
ahasbini Avatar answered Sep 21 '22 06:09

ahasbini