简体   繁体   English

Android Studio中的Eclipse库jar文件

[英]Eclipse library jar files in Android studio

image here 图片在这里

In the picture you can see the libs folder and it contans two sub folders and a jar file named unity classes. 在图片中,您可以看到libs文件夹,它包含两个子文件夹和一个名为unity classes的jar文件。 I want to merge this project with my android studio project so in this case i want to copy my eclipse project java files, res folder and libs and everything. 我想将此项目与我的android studio项目合并,因此在这种情况下,我想复制我的Eclipse项目Java文件,res文件夹和libs以及所有内容。 I copied everything in my android studio project but confused that how to copy libs folder from eclipse to android studio. 我在android studio项目中复制了所有内容,但对如何将eclipse的libs文件夹复制到android studio感到困惑。 I know that there is a compile ' ' option in build.gradle but what to write their? 我知道build.gradle中有一个compile'选项,但是要写些什么呢? I am a newbie so please tell me what to do? 我是新手,所以请告诉我该怎么办? I just want these libs folder to be written in android studio 我只想将这些libs文件夹写在android studio中

I found the answer finally. 我终于找到答案了。 Its simple and i just have to add this line 它很简单,我只需要添加这一行

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

Create a libs folder 创建一个libs文件夹

  • -Add your jars to this folder(Copy and paste them). -将您的罐子添加到此文件夹(复制并粘贴)。
  • -Right click on the jar-> Synchronize 'your.jar name' -右键单击jar->同步“ your.jar名称”

Finally just add below code in your gradle, This will add all the jars 最后,在gradle中添加以下代码,这将添加所有jar

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
}

You can also add separate jar by : 您还可以通过以下方式添加单独的jar:

compile files('libs/yourJarName.jar')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM