错误在Android Studio中添加外部JAR库 [英] Error in adding external Jar libraries in android studio

查看:246
本文介绍了错误在Android Studio中添加外部JAR库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是w.r.t的Andr​​oid 1.3.2工作室

This is w.r.t Android Studio 1.3.2

所以,当我试图从导入模块 - >导入现有JAR添加了回购,库添加为一个独立的模块,并列入settings.gradle。

So when i try to add the Repo from the Import Module->Import Existing Jar,the library is added as a separate module and included in the settings.gradle.

在此之后,当我尝试使用的jar,我得到的消息
添加库'X'到classpath
有一次,我将它添加到类路径中,我能够访问类然而该项目不建立与下面的错误,

After this when I try to use the Jar, I get the message Add Library 'x' to the classpath Once i add this to the classpath,I am able to access the classes however the project does not build with the following error,

类XX无法找到(XX属于罐子)
有没有解决方法了这一点。

class Xx cannot be found(Xx belongs to the jar) Is there a work-around to this.

我可以creatings在应用程序添加罐子libs文件夹模块,并点击添加为库
不过,我不希望主模块里面的罐子。

I can add the jar by creatings a libs folder in the app module and clicking on add as library. However I do not want the jar inside the main module.

推荐答案

当您添加任何模块依赖,那么它不会自动添加到文件的gradle

When you add any module dependency then it will not automatically added to gradle file.

您必须添加扶养手动摇篮文件。

You have to add that dependancy to gradle file manually..

现在在这里要添加模块到Android Studio项目的话,你必须添加

Now here you are adding module to Android Studio project then, You have to add

  compile project(':module_name') 

所以,你模块将被连接到您的应用程序模块。

So that you module will be attached to your app module.

希望这会有所帮助。

感谢您!

这篇关于错误在Android Studio中添加外部JAR库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆