Java “项目结构”中没有“项目设置”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18909550/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No "Project settings" in "Project structure"
提问by Gralex
I start learn android development, and I can't figure out how to add library to project. I use Android Studio. I create new project, and I don't have Project Settings in Project Structure.
我开始学习android开发,但我不知道如何将库添加到项目中。我使用安卓工作室。我创建了新项目,但项目结构中没有项目设置。
采纳答案by Jon
Right click on your Package name in the Project window and select "Open Module Settings." That should bring up the settings window you're looking for.
在“项目”窗口中右键单击您的包名称,然后选择“打开模块设置”。这应该会打开您正在寻找的设置窗口。
Personally, I haven't had any luck what so ever with the Gradle documentation so I've just been importing and creating different projects and trying to figure out how things are set up. I'm sure there is probably some better documentation for it out there somewhere, but I haven't been able to find it yet.
就我个人而言,我对 Gradle 文档没有任何运气,所以我一直在导入和创建不同的项目,并试图弄清楚事情是如何设置的。我确信在某处可能有一些更好的文档,但我还没有找到它。
回答by owe
You have to do it manually with gradle.
您必须使用 gradle 手动完成。
In this postyou can see how your project structure should be and how to add a project lib to your project.
在这篇文章中,您可以看到您的项目结构应该如何以及如何将项目库添加到您的项目中。
A little summary:
一个小总结:
- create a folder named "libraries" into your Project "TestAddLib"
- copy your project lib into this folder
then you have to configure your gradle files:
in you settings.gradle you have to include all your moduls -> your TestAddLib and your project libs
- 在您的项目“TestAddLib”中创建一个名为“libraries”的文件夹
- 将您的项目库复制到此文件夹中
然后你必须配置你的gradle文件:
在你的 settings.gradle 中,你必须包含所有的模块 -> 你的 TestAddLib 和你的项目库
include ':TestAddLib', ':TestAddLib:libraries:projectLib'
include ':TestAddLib', ':TestAddLib:libraries:projectLib'
- add the project lib into your TestAddLib (-> edit build.gradle file of your TestAddLib) as dependency using this code:
- 使用以下代码将项目库添加到您的 TestAddLib(-> 编辑您的 TestAddLib 的 build.gradle 文件)作为依赖项:
dependencies { compile project(':TestAddLib:libraries:projectLib') }
dependencies { compile project(':TestAddLib:libraries:projectLib') }
- But remember: Your project lib need a build.gradle file, too. You get the right file by exporting it in eclipse.
- 但请记住:您的项目库也需要一个 build.gradle 文件。您可以通过在 eclipse 中导出文件来获得正确的文件。
Here are more questions about gradle and project libs: general description, build.gradle file of project lib
这里有更多关于gradle和项目库的问题:general description, build.gradle file of project lib