How to import a .aar file into Android Studio 1.1.0 and use it in my code

PoliceEstebi

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:

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.

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

PoliceEstebi

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. Add a .aar file in my libs folder.
  2. Use "New Module" option under File menu.
  3. Import the .aar file.
  4. Build gradle and compile the project.

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

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

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
}

}

You can find additional information about this problem here https://groups.google.com/forum/#!topic/adt-dev/1Ho_c8dALQQ

I guess in version 1.2.0 this problem will be solved.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use the downloaded maven aar file in my Android project?

How to import .AAR module on Android Studio 4.2

How to remove .aar file form Android Studio

Create aar file in Android Studio

How to build CHAQUOPY Android library (.AAR or .JAR file) in Android Studio

How to use my own Android.mk file with Android Studio

Android studio @aar import creating incorrect exploded-aar directory

How to import github project to my android studio

Android Studio Create AAR using another AAR file and jar inside

Android studio aar file error class not found

Class in AAR file not available in Android Studio

Why won't Android Studio create my AAR file in release mode

How to import a ZIP file to Android Studio?

How to create new Android AAR in Android Studio

how do i find my SHA 1 for my android app in android studio?

How to create *.aar file from "existing" android studio project ( Not creating new android library)?

How to use an aar including other aar in Xamarin.Android

How do I import my own object in vs studio code?

how I can use object in my file from another file (Android Studio)

How do I tweak my 0-1 knapsack code with the following constraints [JAVA]

How would I force user input to be only 1 and 0 in my code

Gradle error Android studio 1 import facebook sdk

how to use less mixins file in my code?

How to use Unity exported Android library as an AAR?

How to build Flutter project with Android aar file?

How to publish an Android .aar file to Artifactory

How to download leakcanary-android aar file

The code meant to generate [((0,0),0), ((0,1),0), ((1,0),0), ((1,1),0)] actually gives [0, 0, 0, 1, 1, 0, 1, 1], how to fix it?

How to use Python 'in' operator to check my list/tuple contains each of the integers 0, 1, 2?