idea导入library_如何在IntelliJ IDEA中添加外部库?

bd96500e110b49cbb3cd949968f18be7.png

I am trying to add external library (places it in the /libs directory) to my project. When I try to use the methods from that library, I see that they are in red color which means that the library is not recognized. When I click Ctrl+B, I get a message "Cannot find declaration to go to".

I use these steps to add a library (JAR file):

1. copy the library file into /libs dir

2. open Project Structure -> Global Libraries -> Attach clases

3. find the library and click ok

Is this proper way to do it?

PS. I am trying to add AdMob .jar file this way.

解决方案

Easier procedure on latest versions:

Copy jar to libs directory in the app (you can create the directory it if not there)

Refresh project so libs show up in the structure (right click on project top level, refresh/synchronize)

Expand libs and right click on the jar

Select "Add as Library"

Done

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值