参考: http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio
举例:
库: https://github.com/AltBeacon/android-beacon-library.git
主工程: https://github.com/AltBeacon/android-beacon-library-reference.git
File->Import Project:先导入android-beacon-library-reference工程
File->Import Module:导入android-beacon-library作为module,module名为:android-beacon-library
这个时候gradle文件sync是不成功的。因为默认会在主工程目录下寻找android-beacon-library目录,找不到。所以要在setting.gradle里加上
- project(':android-beacon-library').projectDir = new File('../android-beacon-library')
setting.gradle里包含新的库
- include ':app', ':android-beacon-library'
android-beacon-library-reference的app模块下的build.gradle把引用aar改为引用工程
- dependencies {
- compile project(':android-beacon-library')
- //compile 'org.altbeacon:android-beacon-library:2+@aar'}
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。