简体   繁体   English

将另一个Gradle项目导入现有android项目时拒绝了Android Studio访问

[英]Android Studio access denied while importing another gradle project into existing android project

I have following two projects: 我有以下两个项目:

  • An Android project developed using Android Stuido 0.8.9 使用Android Stuido 0.8.9开发的Android项目
  • A pure Java library project developed using IntelliJ IDEA with Gradle 使用IntelliJ IDEA和Gradle开发的纯Java库项目

What I want to do is to add that Java library project as a module in my Android project 我要做的是将该Java库项目作为模块添加到我的Android项目中
I did so by selecting 我是通过选择

  • File 文件
  • Import Module 导入模块
  • Select the build.gradle of the java library project 选择Java库项目的build.gradle
  • set the module name 设置模块名称
  • Finish

As I pressed the Finish button, the Android Studio Event Log popped a message saying 当我按下“完成”按钮时,Android Studio事件日志弹出一条消息,提示

11:36:42 FileNotFoundException: C:\\Users\\xxxxx\\AndroidStudioProjects\\MyAndroidProject\\MyJavaLibrary (Access Denied.) 11:36:42 FileNotFoundException:C:\\ Users \\ xxxxx \\ AndroidStudioProjects \\ MyAndroidProject \\ MyJavaLibrary(访问被拒绝。)

I checked the path it described and made sure the folder access properties are all open but still got the same error message. 我检查了它描述的路径,并确保所有文件夹访问属性均已打开,但仍然收到相同的错误消息。

Anybody know how to deal with this? 有人知道如何处理吗?

By the way I am using Windows 7 顺便说一句,我正在使用Windows 7

I had the same problem with Android Studio 1.0.1. 我在Android Studio 1.0.1中遇到了同样的问题。

It seems that Import Module will unexpectedly access the directory PROJECT_DIR/MODULE_NAME , instead of where the module really stays. 看来, 导入模块将意外访问目录PROJECT_DIR / MODULE_NAME ,而不是模块实际驻留的位置。

I solve it by specifying the module to import in settings.gradle with relative path, like this: 我通过指定要导入的具有相对路径的settings.gradle模块来解决此问题,如下所示:

include ':../:LibraryModule1', ':../../:LibraryModule2' 包括':../ :: LibraryModule1',':../../ :: LibraryModule2'

Then Sync Now will import the module automatically. 然后, 立即同步将自动导入模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM