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

后端 未结 23 1807
故里飘歌
故里飘歌 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:30

    The below approach works with latest Android studio (> v0.8.x):

    • Save the aar file under app module's libs folder (eg: //libs/myaar.aar)

    • Add the below to build.gradle of your "app" module folder (not your project root build.gradle). Note the name in compile line, it is myaar@aar not myaar.aar.

      dependencies {
          compile 'package.name.of.your.aar:myaar@aar'
      }
      
      repositories{
          flatDir{
              dirs 'libs'
          }
      }
      
    • Click Tools -> Android -> Sync Project with Gradle Files

提交回复
热议问题