gpt4 book ai didi

android - 如何在Android Studio中使用导入的库项目?

转载 作者:行者123 更新时间:2023-11-30 01:13:23 25 4
gpt4 key购买 nike

我按照本指南导入了库项目:https://stackoverflow.com/a/20497933现在我有一个包含我所需库的 libs 文件夹。

但是我如何在我的代码中使用它。我无法导入 com.github.whateverlibrary,也无法使用 com.mypackagename.whateverlibrary

如何在我的项目中引用这个本地库?

编辑:

我的 settings.gradle 文件:

include ':libs:MyLibrary'

我的 app.gradle 文件:

compile fileTree(include: ['MyLibrary'], dir: 'libs')

最佳答案

要从列为依赖项的库中添加导入,请使用类的完全限定名称。例如,要从 https://github.com/bumptech/glide 导入,您将使用库中的名称,无需任何修改,例如添加 com.githubcom.yourpackagename
要将 Glide 导入到您的类中,您可以使用

import com.bumptech.glide.Glide;

参见 sample projects为了更好的理解

关于android - 如何在Android Studio中使用导入的库项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38190431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com