1.1.先创建一个PersonLibDemo的一个Android项目,在这个项目创建一个类。

2.然后对应的build.gradle下边apply plugin: ‘com.android.application’ 改成
apply plugin: ‘com.android.library’如下图:

3.build->cleran project 会出现错误,如下图(只需将applicationId “com.example.shinelon.personlibdemo”代码去掉或者注释掉即可)如下图:

4.创建主项目,然后步骤:file->New->import Module…


6.gradle之后还需要去设置一下引用他 步骤: 右键app->open Module Settings…

7.打开后 步骤:点击app->Dependencies->点击+号->然后点击Module dependency

8.之后点击ok,ok!

网友评论