Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

How to import a .aar file into Android Studio 1.1.0 and use it in my 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:

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To import an .aar library:

  1. Go to File>New>New Module
  2. Select "Import .JAR/.AAR Package" and click next.
  3. Enter the path to the .aar file and click finish.
  4. Go to File>Project Structure (Ctrl+Shift+Alt+S).
  5. Under "Modules," in left menu, select "app."
  6. Go to "Dependencies" tab.
  7. Click the green "+" in the upper right corner.
  8. Select "Module Dependency"
  9. Select the new module from the list.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...