简体   繁体   English

将jar导入android

[英]Importing a jar into android

I'm trying to import a jar named Security.jar into an Android app that I'm currently working on, however, no matter what I do I cannot get AS to recognize the package that I'm importing. 我正在尝试将一个名为Security.jar的jar导入当前正在使用的Android应用中,但是,无论我做什么,我都无法获得AS来识别要导入的软件包。 I pasted the jar into the libs folder that I created for the app and synced the gradle files, as well as modified the dependancies, all to no avail. 我将jar粘贴到为该应用程序创建的libs文件夹中,并同步了gradle文件,以及修改了依赖关系,但都无济于事。 If anyone sees ANYTHING that's wrong please let me know! 如果有人发现任何问题,请告诉我! Here's a link to some pictures pertaining to the issue. 这是一些有关此问题的图片的链接。

http://imgur.com/a/sEoXi http://imgur.com/a/sEoXi

error log build.gradle 错误日志build.gradle

I believe that you should do this: 我相信您应该这样做:

compile files('libs/your.api.jar')

When you've pasted the jar file in the libs folder. 将jar文件粘贴到libs文件夹中后。 Give it a shot. 试一试。

A good way to add external JARs to your Android project or any Java project is: 将外部JAR添加到您的Android项目或任何Java项目的一种好方法是:

right click on your project .. then goto properties.. then click on java build path.. then click on libraries... then click on add External JARs.. select jar file .. click on ok 右键单击您的项目..然后转到属性..然后单击Java构建路径..然后单击库...,然后单击添加外部JAR。.选择jar文件..单击确定

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

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