[英]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更新 2这已在 Android Studio 1.2 Beta 3 中得到修复
Update: This has reportedly been fixed in an upcoming release of Android Studio.更新:据报道,这已在即将发布的 Android Studio 版本中修复。
In Android Studio 1.2 Beta 2 I started getting the following warnings when syncing Gradle.在 Android Studio 1.2 Beta 2 中,我在同步 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:在我的 Android Studio 项目中,我有以下模块:
- App
- Library1
- Library2
Module: App build.gradle
snippet:模块:App
build.gradle
片段:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Library1')
compile project(':Library2')
}
settings.gradle
file: settings.gradle
文件:
include ':App'
include ':Library1'
include ':Library2'
project(':Library1').projectDir = new File(settingsDir, '../library1/lib')
project(':Library2').projectDir = new File(settingsDir, '../Library2/lib')
I faced this with Android Studio 2.2.3.我在 Android Studio 2.2.3 中遇到了这个问题。 The problem was with the
.iml
file that was causing the problem.问题出在导致问题的
.iml
文件上。
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.将模块文件夹导入项目目录并添加更改以在
settings.gradle
包含模块后,从模块文件夹中删除.iml
文件并执行 Gradle 同步。 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.然后右键单击项目窗口中的任何模块,然后单击“配置项目子集...”,如果未选中导入的模块,请选中它,Android Studio 应该执行 Gradle 同步。 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.届时,导入的模块将出现在项目窗口中,并将重新生成一个不会导致任何问题的
.iml
文件。
.iml
file under the error
module.error
模块下的.iml
文件。右键单击项目,选择“配置项目子集...”并选择您的模块,重建您的项目。
I met the same problem on AS 2.0 preview, and I fixed it by following steps:我在 AS 2.0 preview 上遇到了同样的问题,我按照以下步骤修复了它:
1.Rename the module. 1.重命名模块。 2.Change the names in app/build.gradle and setting.gradle.
2.更改 app/build.gradle 和 setting.gradle 中的名称。 3.Start gradle sync.
3.启动gradle同步。
I don't know why but it works on my issue.我不知道为什么,但它适用于我的问题。
Check in settings.检查设置。 of your app.
你的应用程序。 Down there is the field "Load/Unload Modules"
下面是“加载/卸载模块”字段
Your module might be unloaded, that's why Android Studio ignores it even if you specify it in Gradle.您的模块可能已卸载,这就是即使您在 Gradle 中指定它,Android Studio 也会忽略它的原因。
At least that was the problem for me.至少这对我来说是个问题。
如果您使用的是React-native>60
,那么您应该在进行 Gradle 同步之前在项目的根目录上运行npx jetify
。
For me the following worked in Android Studio 3.5.3对我来说,以下在 Android Studio 3.5.3 中有效
First of all, check if the path is correct in your Gradle settings.首先,检查您的 Gradle 设置中的路径是否正确。
If the path is correct then invalidate caches & restart by navigating to the top 'File' menu如果路径正确,则通过导航到顶部的“文件”菜单使缓存无效并重新启动
It is a known bug introduced in 1.2 Beta 2.这是 1.2 Beta 2 中引入的已知错误。
See This issue on the Android issue tracker.请参阅 Android 问题跟踪器上的此问题。 Fix should be out within hours.
修复应该在几个小时内完成。
Problem:问题:
This problem can also occur when you change the path to the module.当您更改模块的路径时,也会出现此问题。
settings.gradle设置.gradle
include ':app', ':filechooserlibrary'
project(':filechooserlibrary').projectDir = new File('../../repos-github/file-chooser/file-chooser-library/filechooserlibrary')
I changed the path to '../../github/file-chooser/file-chooser-library/filechooserlibrary'
我将路径更改为
'../../github/file-chooser/file-chooser-library/filechooserlibrary'
The old path did not exist any more.旧路已不复存在。 But then, instead of accepting the new path, Android Studio recreated the old path structure thus referring to an empty directory.
但是,Android Studio 并没有接受新路径,而是重新创建了旧路径结构,从而引用了一个空目录。
Solution: So, I deleted this obsolete path structure and restarted Android Studio, after deleting the .iml file (I don't know if this is necessary, but it cannot do harm).解决方案:所以,我删除了这个过时的路径结构并在删除了 .iml 文件后重新启动了 Android Studio(我不知道这是否有必要,但它不会造成伤害)。 Then I reimported the Gradle project and it worked.
然后我重新导入了 Gradle 项目并且它起作用了。
Try using an updated version of NDK
.尝试使用
NDK
的更新版本。
I faced the same issue.我遇到了同样的问题。 I was using
NDK
version r17c
.我使用的是
NDK
版本r17c
。 Issue solve after using r21e
.使用
r21e
后问题解决。
4.1.3
4.1.3
18.04.5
18.04.5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.