Skip to content

Commit 3ef8bba

Browse files
committed
添加 common-third-library,管理第三方公共依赖(至少 2 个模块都有引用的第三方依赖)
1 parent b0251f6 commit 3ef8bba

File tree

13 files changed

+162
-68
lines changed

13 files changed

+162
-68
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ kapt {
121121

122122
dependencies {
123123

124+
implementation project(':common-third-library')
124125
// kapt 'com.android.databinding:compiler:3.1.0'
125126
kapt "org.androidannotations:androidannotations:$AAVersion"
126127
implementation "org.androidannotations:androidannotations-api:$AAVersion"

common-coding/build.gradle

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,47 +37,18 @@ android {
3737
}
3838
}
3939

40-
def AAVersion = '4.4.0'
41-
4240
dependencies {
43-
configurations {
44-
all*.exclude group: 'com.android.support', module: 'support-v13'
45-
}
4641

4742
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
4843
api "org.androidannotations:androidannotations-api:$AAVersion"
49-
api 'com.loopj.android:android-async-http:1.4.9'
5044

51-
// 测试框架
52-
implementation "com.android.support:support-annotations:$supportVersion"
53-
androidTestImplementation "com.android.support.test:runner:$runnerVersion"
54-
androidTestImplementation "com.android.support.test:rules:$rulesVersion"
55-
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
45+
configurations {
46+
all*.exclude group: 'com.android.support', module: 'support-v13'
47+
}
5648

5749
api files('libs/android-viewbadger.jar')
5850
api files('libs/pinyin4j-2.5.0.jar')
5951

60-
// google 兼容库
61-
def supportVersion = '27.1.1'
62-
api "com.android.support:support-v4:$supportVersion"
63-
// api "com.android.support:support-v13:$supportVersion"
64-
api "com.android.support:design:$supportVersion"
65-
api "com.android.support:percent:$supportVersion"
66-
api "com.android.support:cardview-v7:$supportVersion"
67-
api "com.android.support:appcompat-v7:$supportVersion"
68-
// api "com.android.support:support-annotations:$supportVersion"
69-
api 'com.android.support.constraint:constraint-layout:1.0.2'
70-
// umeng 统计
71-
api 'com.umeng.analytics:analytics:latest.integration'
72-
// 网络请求
73-
api 'com.squareup.retrofit2:retrofit:2.1.0'
74-
api 'com.squareup.okhttp3:logging-interceptor:3.5.0'
75-
api 'com.google.code.gson:gson:2.8.0'
76-
api 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
77-
api 'com.squareup.okhttp3:okhttp:3.5.0'
78-
api 'io.reactivex:rxjava:1.0.14'
79-
api 'io.reactivex:rxandroid:1.0.1'
80-
api 'com.squareup.retrofit2:converter-gson:2.2.0'
8152
// 方便显示 view 显示一些样式,不用写 selector
8253
api 'com.flyco.roundview:FlycoRoundView_Lib:1.1.4@aar'
8354
// 列表控件,
@@ -89,16 +60,13 @@ dependencies {
8960

9061
api 'pl.droidsonroids.gif:android-gif-drawable:1.1.11'
9162

92-
api project(':luban')
93-
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
63+
implementation project(':luban')
9464

9565
/*
9666
* 提供给子模块公用
9767
*/
98-
// 常用工具类
99-
api 'com.blankj:utilcode:1.9.0'
100-
// 打印 log
101-
api 'com.orhanobut:logger:1.15'
68+
69+
implementation project(':common-third-library')
10270

10371
}
10472

common-third-library/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

common-third-library/build.gradle

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 27
5+
6+
defaultConfig {
7+
minSdkVersion 15
8+
targetSdkVersion 26
9+
versionCode 1
10+
versionName "1.0"
11+
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
15+
buildTypes {
16+
release {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
22+
}
23+
24+
def AAVersion = '4.4.0'
25+
26+
dependencies {
27+
28+
29+
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
30+
api "org.androidannotations:androidannotations-api:$AAVersion"
31+
32+
// 测试框架
33+
implementation "com.android.support:support-annotations:$supportVersion"
34+
androidTestImplementation "com.android.support.test:runner:$runnerVersion"
35+
androidTestImplementation "com.android.support.test:rules:$rulesVersion"
36+
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
37+
38+
39+
api "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlinVersion"
40+
41+
api 'com.loopj.android:android-async-http:1.4.9'
42+
43+
// 图片显示
44+
api 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
45+
// gif 显示
46+
api 'pl.droidsonroids.gif:android-gif-drawable:1.1.11'
47+
api 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
48+
api 'com.github.lzyzsd:circleprogress:1.1.0@aar'
49+
50+
// google 兼容库
51+
def supportVersion = '27.1.1'
52+
api "com.android.support:support-v4:$supportVersion"
53+
// api "com.android.support:support-v13:$supportVersion"
54+
api "com.android.support:design:$supportVersion"
55+
api "com.android.support:percent:$supportVersion"
56+
api "com.android.support:cardview-v7:$supportVersion"
57+
api "com.android.support:appcompat-v7:$supportVersion"
58+
// api "com.android.support:support-annotations:$supportVersion"
59+
api 'com.android.support.constraint:constraint-layout:1.0.2'
60+
// umeng 统计
61+
api 'com.umeng.analytics:analytics:latest.integration'
62+
63+
// kotlin
64+
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
65+
66+
// 网络请求
67+
api 'com.squareup.retrofit2:retrofit:2.1.0'
68+
api 'com.squareup.okhttp3:logging-interceptor:3.5.0'
69+
api 'com.google.code.gson:gson:2.8.0'
70+
api 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
71+
api 'com.squareup.okhttp3:okhttp:3.5.0'
72+
api 'io.reactivex:rxjava:1.0.14'
73+
api 'io.reactivex:rxandroid:1.0.1'
74+
api 'com.squareup.retrofit2:converter-gson:2.2.0'
75+
76+
// 常用工具类
77+
api 'com.blankj:utilcode:1.9.0'
78+
// 打印 log
79+
api 'com.orhanobut:logger:1.15'
80+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package net.coding.program.third;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("net.coding.program.third.test", appContext.getPackageName());
25+
}
26+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="net.coding.program.third"/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">common-third-library</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package net.coding.program.third;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

git-code-coding/build.gradle

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,7 @@ android {
2525
}
2626

2727
dependencies {
28-
implementation fileTree(include: ['*.jar'], dir: 'libs')
29-
implementation "com.android.support:appcompat-v7:$supportVersion"
30-
testImplementation 'junit:junit:4.12'
31-
androidTestImplementation 'com.android.support.test:runner:1.0.1'
32-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
33-
34-
// 图片显示
35-
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
36-
37-
// google 兼容库
38-
compile "com.android.support:support-v4:$supportVersion"
39-
compile "com.android.support:design:$supportVersion"
40-
28+
implementation project(':common-third-library')
4129
implementation project(':common-coding')
4230
}
4331

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include ':app', ':widget-pick-photo', ':common-coding', ':pay-coding', ':share-coding', ':recyclerview-coding', ':git-code-coding'
1+
include ':app', ':widget-pick-photo', ':common-coding', ':pay-coding', ':share-coding', ':recyclerview-coding', ':git-code-coding', ':common-third-library'
22
include ':bottom-bar'
33
include ':luban'
44

terminal-coding/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ dependencies {
5858
implementation "com.android.support:appcompat-v7:$supportVersion"
5959
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
6060

61+
62+
implementation project(':common-third-library')
6163
implementation project(':common-coding')
6264
}
6365

widget-pick-photo/build.gradle

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,7 @@ dependencies {
6565
implementation "org.androidannotations:androidannotations-api:$AAVersion"
6666
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlinVersion"
6767

68-
implementation fileTree(include: ['*.jar'], dir: 'libs')
69-
70-
// 图片显示
71-
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
72-
// gif 显示
73-
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.11'
74-
75-
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
76-
77-
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
78-
79-
// google 兼容库
80-
// implementation "com.android.support:design:$supportVersion"
81-
implementation "com.android.support:appcompat-v7:$supportVersion"
82-
implementation "com.android.support:support-v4:$supportVersion"
83-
68+
implementation project(':common-third-library')
8469
implementation project(':common-coding')
8570
}
8671

0 commit comments

Comments
 (0)