简体   繁体   English

如何将此库添加到我的项目中?

[英]how to add this library to my project?

link I want add the dfu library to my project.链接 我想将dfu 库添加到我的项目中。 it has a download oètopn, but there is no direct download and it says to use Gradle to add it.它有一个下载 oètopn,但没有直接下载,它说使用 Gradle 添加它。
Anyway, the documentation says to do this step.无论如何, 文档说要执行此步骤。

Clone the project, or just the DFULibrary folder (using sparse-checkout) to a temporary location.将项目或仅将 DFULibrary 文件夹(使用 sparse-checkout)克隆到临时位置。

Copy the DFULibrary folder to your projects root, for example to AndroidstudioProjects.将 DFULibrary 文件夹复制到您的项目根目录,例如 AndroidstudioProjects。

Add the dfu module to your project:将 dfu 模块添加到您的项目中:

Add '..:DFULibrary:dfu' to the settings.gradle file: include ':app', '..:DFULibrary:dfu'在 settings.gradle 文件中添加 '..:DFULibrary:dfu':include ':app', '..:DFULibrary:dfu'

Open Project Structure -> Modules -> app -> Dependencies tab and add dfu module dependency.打开 Project Structure -> Modules -> app -> Dependencies 选项卡并添加 dfu 模块依赖项。 You may also edit the build.gradle file in your app module manually by adding the following dependency: compile project(':..:DFULibrary:dfu')您还可以通过添加以下依赖项手动编辑应用模块中的 build.gradle 文件:compile project(':..:DFULibrary:dfu')

But I can't find the DFULibrary folder in this project .但是我在这个项目中找不到 DFULibrary 文件夹。

Add in your build.gradle在你的build.gradle添加

dependencies {
    compile 'no.nordicsemi.android:dfu:1.0.4'
}

I started using it today.我今天开始使用它。 It is a bit different.它有点不同。

Use menu File -> Project Structure -> Modules.使用菜单文件 -> 项目结构 -> 模块。

在此处输入图片说明

Click to choose library dependency点击选择库依赖在此处输入图片说明

Search the library that you want to add in your project and click on to import.搜索要添加到项目中的库,然后单击以导入。 在此处输入图片说明

dependencies {
    compile "com.android.support:appcompat-v7:28.0.0"
}

Hope this will help you enough.希望这对你有足够的帮助。

Go to http://gradleplease.appspot.com/ and search for the library you want.转到http://gradleplease.appspot.com/并搜索您想要的库。

Go to build.gradle file and add it under dependencies{...} module and add that line and hit the sync button转到 build.gradle 文件并将其添加到 dependencies{...} 模块下并添加该行并点击同步按钮

dependencies {
    compile 'no.nordicsemi.android:dfu:0.6'
}

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

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