简体   繁体   English

如何正确地将库和模块导入android studio

[英]how to import library and modules to android studio properly

I want to use this library ( https://github.com/ikimuhendis/LDrawer ) in my project. 我想在我的项目中使用这个库( https://github.com/ikimuhendis/LDrawer )。 but when i import it as new modules i can't see where it is? 但是当我将它作为新模块导入时,我看不到它在哪里? and then some gradle error occur like this: 然后出现一些gradle错误,如下所示:

cant find runProguard 找不到runProguard

and then i replaced this with minifyEnabled then this error occur "change gradle version Error:Library projects cannot set applicationId. applicationId is set to in default config" 然后我用minifyEnabled替换它然后发生此错误“更改gradle版本错误:库项目无法设置applicationId。在默认配置中将applicationId设置为”

then i clear applicationId but i still have this error! 然后我清除applicationId但我仍然有这个错误! i can't understand what is sample folder, library folder, or root folder in project! 我无法理解项目中的示例文件夹,库文件夹或根文件夹是什么! i have to import which one?! 我必须导入哪一个?!

I import sample project and root of this project with import new project but i have errors! 我导入示例项目和导入新项目的项目的根,但我有错误! newly i migrate to android studio from eclipse bcz many open source project that using android studio.I guess all of my question because i can't understand android studio structure properly! 最近我从eclipse bcz迁移到Android工作室很多使用android studio的开源项目。我猜我所有的问题因为我无法正确理解android studio结构!

use build.gradle to import the project easily. 使用build.gradle轻松导入项目。 Make sure that you add it to the build.gradle under app(or your custom name) folder 确保将其添加到app(或您的自定义名称)文件夹下的build.gradle中

in your build.gradle file, add the following dependencies, then sync gradle. 在build.gradle文件中,添加以下依赖项,然后同步gradle。 that's all you need to do 这就是你需要做的一切

dependencies {
    compile 'com.ikimuhendis:ldrawer:0.1'
    compile 'com.android.support:appcompat-v7:21.0.+'
}

add the following dependencies: 添加以下依赖项:

dependencies {
    compile 'com.ikimuhendis:ldrawer:0.1'
    compile 'com.android.support:appcompat-v7:21.0.+'
}

change library's build.gradle and sample's build.gradle. 更改库的build.gradle和sample的build.gradle。 it will be ok, you can try it. 没关系,你可以尝试一下。

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

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