Importing a maven project on Github into Android Studio as dependency

时间:2017-04-06 17:07:57

标签: android maven android-studio

I am trying to work on an android app using Android Studio and I want to use the SlidingMenu github project in my app. This github project appears to be related to Maven (Disclosure: I've never used Maven before).

I want to be able to reference its classes in my Android Studio project. I tried to create a new module, but that it creates its own directory structure. I want to just import the existing file structure of this github project (so I don't change anything related to it).

Can anyone tell what is the recommended way to do this. Thanks.

1 个答案:

答案 0 :(得分:0)

如果可以在maven中心搜索中找到此库,则可以转到

  • 文件
  • 项目结构

  • 在模块下的左侧“app”中选择
  • 转到Dependecies选项卡

  • 单击右侧的+按钮并选择库依赖项并搜索您的lib。(我认为还有另一个滑动菜单库)

  • 在您的代码中使用它

否则:

如果您想要添加您发布的库,请下载并转到

  • file
  • 项目结构
  • 点击+按钮(此时左上角)
  • 在新窗口中选择“import gradle project”选择lib的文件夹(如果不这样做,选择里面的库文件夹(idk this lib))。我认为它将导入你的lib
  • 然后转到依赖项标签
  • 点击+按钮并选择添加模块依赖项,这次选择你的lib和你的完成

  • 在您的代码

  • 中使用它

玩得开心