[英]How to import new library in Android studio
I want to use this library in Android Studio. 我想在Android Studio中使用此库。 I'm learning how to use Android and searching on stackflow I've found some solution but not working for me.
我正在学习如何使用Android并在stackflow上进行搜索,我找到了一些解决方案,但不适用于我。 Somebody suggest add it from File->Project Structure-> Dependencies Someboby suggest add it from build.grandle My question is: Could I add and use that library or need I anotherone?
有人建议从文件->项目结构->依赖关系中添加它有人建议从build.grandle添加它。我的问题是:我可以添加并使用该库还是需要其他人? I'm using Windows 10. Following more info about Android Studio version: Android version
我正在使用Windows10。以下有关Android Studio版本的详细信息: Android版本
Hello this is C++ library 您好,这是C ++库
please go through the link this may help you how to import and use it 请通过链接,这可能会帮助您如何导入和使用它
https://developer.android.com/studio/projects/add-native-code https://developer.android.com/studio/projects/add-native-code
also there are samples if you want to work with ndk 如果您想使用ndk,也有示例
https://github.com/googlesamples/android-ndk https://github.com/googlesamples/android-ndk
How to import a library from GitHub (Detailed Steps): 如何从GitHub导入库(详细步骤):
1-Find Your Desired Library, for example, this library : Example Library 1-找到所需的库,例如,此库: 示例库
2- Go to jitpack.io and enter the link of the library and click lookup 2-转到jitpack.io并输入库的链接,然后单击查找
3-You will be represented for different versions , usually we choose the latest since it is the better 3-您将代表不同的版本,通常我们选择最新的版本,因为它更好
4- Click on Get it 4-单击获取
5- scroll down and follow the given steps which are adding 5-向下滚动并按照给定的步骤进行添加
maven { url 'https://jitpack.io' }
to your root build.gradle at the end of repositories.After adding it , it should be like 存储库末尾的根目录build.gradle。添加后,它应该像
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
6- Add the given dependency in the other build.gradle(app level) file in dependecies section , for our example jitpack.io has given us this 6-将给定的依赖关系添加到dependecies部分的另一个build.gradle(应用程序级别)文件中,因为我们的示例jitpack.io已经给了我们这个
implementation 'com.github.Badranh:Android-Mac-Address-Util:0.1.0'
7-Click on sync now and after it finishes you will be able to use the library 现在单击7单击同步,完成后您就可以使用该库了
How to import a local library: 如何导入本地库:
1-The local library might be the library you downloaded it from the internet or you did it 1-本地图书馆可能是您从互联网下载的图书馆,或者您做了
2-to import it, click on File -> New -> Import Module and then select the library folder 2-要导入它,请单击文件->新建->导入模块,然后选择库文件夹
3-Right-click your app in project view and select "Open Module Settings" 3-在项目视图中右键单击您的应用,然后选择“打开模块设置”
4-Right-click your app in project view and select "Open Module Settings" 4-在项目视图中右键单击您的应用,然后选择“打开模块设置”
5-Click the "Dependencies" tab and then the '+' button 5单击“依赖性”选项卡,然后单击“ +”按钮
6-Select "Module Dependency" 6选择“模块依赖性”
7-Select Library you just imported it and add it 7选择刚导入的库并添加它
8-Wait for Android Studio To finish and then you can use it Android Studio的8等待功能,然后可以使用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.