如何导入.aar文件到的Andr​​oid 1.1.0工作室,在我的code使用 [英] How to import a .aar file into Android Studio 1.1.0 and use it in my code

查看:124
本文介绍了如何导入.aar文件到的Andr​​oid 1.1.0工作室,在我的code使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读有关这个​​话题很多答案,但他们都没有努力解决我的问题,所以需要这方面的帮助:

I have read a lot answers related to this topic, but none of them have worked to solve my problem, so need help with this:

我需要导入.aar文件与 Android的工作室1.1.0 后,我一直在使用新建模块选项,输入它,其实我没有收到任何错误创建的项目,我可以建立并运行应用程序,但是当我尝试使用一个类从这个.aar文件的Andr​​oid工作室doesn't找到提到它,让我们说这不容承认,我想在我的$包括包C $℃。

I need to import a .aar file into a project created with Android Studio 1.1.0, I have imported it using the "New Module" option and actually I don't receive any error, I can build the application and run it, but when I try to use a class from this .aar file Android Studio doesn´t find the reference to it, let's say it can´t recognize the package that I want to include in my code.

您也许认为我必须补充的依赖,我已经做了,它似乎无法工作。

You are maybe thinking that I must add the dependency, I have already done that, It seems to not work.

所以,有人能告诉我这是导入和使用.aar文件的正确方法 Android的工作室1.1.0

So someone could tell me which is the correct way to import and use a .aar file in Android Studio 1.1.0

推荐答案

阅读大量#2的答案后,我发现我的问题的解决方案,我想让你知道这是我跟着以重现它的步骤

After reading a lot of answers on Stackoverflow, I found the solution for my problem, I want you to know which were the steps I followed in order to reproduce it:


  1. 在我的libs文件夹中添加.aar文件。

  2. 使用新建模块下的文件菜单中的选项。

  3. 导入.aar文件。

  4. 的gradle构建和编译该项目。

当我试图用新的模块在我的应用程序,它不承认新的模块中的任何类。

When I tried to use the new module in my app, It didn't recognize any class inside the new module.

问题是,我是用关系到摇篮的版本的 1.1.0 并没有在这个版本中的错误,所以我的建议是把版本改为 1.0.1 中,有一个问题已经为了解决这个问题<一开href=\"https://$c$c.google.com/p/android/issues/detail?id=162634\">https://$c$c.google.com/p/android/issues/detail?id=162634

The problem is related to the version of Gradle, I was using 1.1.0 and there is a bug in this version, so my suggestion is to change the version to 1.0.1, there is an Issue already open in order to fix this problem https://code.google.com/p/android/issues/detail?id=162634

您应该位于项目的根目录下的build.gradle文件更改版本。

You should change the version in the build.gradle file located in the root of your project.

buildscript {
repositories {
    jcenter()
}
dependencies {

    //classpath 'com.android.tools.build:gradle:1.1.0'
    classpath 'com.android.tools.build:gradle:1.0.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

您可以在这里<一个有关这方面的问题的其他信息href=\"https://groups.google.com/forum/#!topic/adt-dev/1Ho_c8dALQQ\">https://groups.google.com/forum/#!topic/adt-dev/1Ho_c8dALQQ

我想在1.2.0版本,这个问题将得到解决。

I guess in version 1.2.0 this problem will be solved.

这篇关于如何导入.aar文件到的Andr​​oid 1.1.0工作室,在我的code使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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