How to manually include external aar package using new Gradle Android Build System

后端 未结 23 1797
故里飘歌
故里飘歌 2020-11-22 03:58

I\'ve been experimenting with the new android build system and I\'ve run into a small issue. I\'ve compiled my own aar package of ActionBarSherlock which I\'ve called \'act

相关标签:
23条回答
  • 2020-11-22 04:33

    Unfortunately none of the solutions here worked for me (I get unresolved dependencies). What finally worked and is the easiest way IMHO is: Highlight the project name from Android Studio then File -> New Module -> Import JAR or AAR Package. Credit goes to the solution in this post

    0 讨论(0)
  • 2020-11-22 04:33

    you can do something like this:

    1. Put your local libraries (with extension: .jar, .aar, ...) into 'libs' Folder (or another if you want).

    2. In build.gradle (app level), add this line into dependences

      implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')

    0 讨论(0)
  • 2020-11-22 04:34

    Just to simplify the answer

    If .aar file is locally present then include
    compile project(':project_directory') in dependencies of build.gradle of your project.

    If .aar file present at remote then include compile 'com.*********.sdk:project_directory:0.0.1@aar' in dependencies of build.gradle of your project.

    0 讨论(0)
  • 2020-11-22 04:35

    With Android Studio 3.4 and Gradle 5 you can simply do it like this

    dependencies {
        implementation files('libs/actionbarsherlock.aar')
    }
    
    0 讨论(0)
  • 2020-11-22 04:35

    The standard way to import AAR file in an application is given in https://developer.android.com/studio/projects/android-library.html#AddDependency

    Click File > New > New Module. Click Import .JAR/.AAR Package then click Next. Enter the location of the compiled AAR or JAR file then click Finish.

    Please refer the link above for next steps.

    0 讨论(0)
提交回复
热议问题