1.以module形式导入project new->new module
2.将module变为library builder.gradle中将
apply plugin: 'com.android.application' 改为 apply plugin: 'com.android.library'
defaultConfig { applicationId "com.example.administrator.m3demo" 去掉这行
3.编译,在builder->outputs->aar中找到生成的aar
4.移除刚才引入的module,将生成的aar放到libs
dependencies { ..... compile (name:'m3demo-release',ext:'aar') } //repositories{ // flatDir{ // dirs 'libs' // } //}