在Android工作室添加外部JAR文件中的项目摇篮
我有一个可怕的时间增加一个外部JAR我在Android中的gradle工作室项目。我问过类似的问题这里但这些答案还没有为我工作。
I'm having a terrible time adding an external JAR to my gradle project in Android Studio. I asked a similar question here but those answers haven't worked for me.
我创建了一个库
文件夹,并在里面加了我的JAR:
I created a libs
folder and added my JAR in there:
~/android/MyProject/libs $ pwd
/Users/me/android/MyProject/libs
~/android/MyProject/libs $ ls
TestFlightLib.jar
和我添加在下面我的build.gradle
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
做的这一切,我点击生成后 - >重建
项目,但仍然无法让我补充进口com.testflightapp.lib.TestFlight
After doing all this I clicked Build -> Rebuild
project but that still doesn't let me add import com.testflightapp.lib.TestFlight
我也试过右键单击 TestFlightLib.jar
键,将其添加为一个模块的第二个解决方案。这让我补充进口com.testflightapp.lib.TestFlight
成功,但是当我运行
项目我仍然得到错误:摇篮:错误:包com.testflightapp.lib不存在
I also tried the second solution of right clicking TestFlightLib.jar
and adding it as a Module. This lets me add import com.testflightapp.lib.TestFlight
successfully but when I Run
the project I still get the error: Gradle: error: package com.testflightapp.lib does not exist
我是什么做错了吗?
我怎么能只是一个外部JAR添加到我的项目的gradle?
How can I simply add an external JAR to my gradle project?
试试这个:
- 右键点击您的项目
- 选择开放模块设置
- 单击模块,然后在依赖性
- 检查你的文件存在于列表
- 如果不是,preSS +,并将其添加为一个文件