Skip to content

Commit 4738c1f

Browse files
author
huangx
committed
修改readme
1 parent 296f75b commit 4738c1f

8 files changed

Lines changed: 20 additions & 86 deletions

File tree

README.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,14 @@ build/generated/source/junk
5353
### 使用插件[methodCount](https://github.com/KeepSafe/dexcount-gradle-plugin)对比
5454

5555
#### 未加垃圾代码
56-
```
57-
Total methods in app-debug.apk: 26162 (39.92% used)
58-
Total fields in app-debug.apk: 12771 (19.49% used)
59-
Total classes in app-debug.apk: 2897 (4.42% used)
60-
Methods remaining in app-debug.apk: 39373
61-
Fields remaining in app-debug.apk: 52764
62-
Classes remaining in app-debug.apk: 62638
63-
```
56+
57+
**项目代码占比 0.13%**
58+
59+
![方法总数](images/before_total.jpg)![项目方法数](images/before_project.jpg)
60+
6461

6562
#### 加了垃圾代码
66-
```
67-
Total methods in app-release-unsigned.apk: 59733 (91.15% used)
68-
Total fields in app-release-unsigned.apk: 13462 (20.54% used)
69-
Total classes in app-release-unsigned.apk: 4488 (6.85% used)
70-
Methods remaining in app-release-unsigned.apk: 5802
71-
Fields remaining in app-release-unsigned.apk: 52073
72-
Classes remaining in app-release-unsigned.apk: 61047
73-
```
74-
增加了1591个类33571个方法
63+
64+
**项目代码占比 52.93%**
65+
66+
![方法总数](images/after_total.jpg)![项目方法数](images/after_project.jpg)

app/build.gradle

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43
apply plugin: 'android-junk-code'
54
apply plugin: 'com.getkeepsafe.dexcount'
65
apply plugin: 'kotlin-kapt'
76

87
android {
9-
compileSdkVersion 29
8+
compileSdkVersion 30
109

1110
defaultConfig {
1211
applicationId "cn.hx.plugin.junkcode.demo"
1312
minSdkVersion 16
14-
targetSdkVersion 29
13+
targetSdkVersion 30
1514
versionCode 1
1615
versionName "1.0"
1716
multiDexEnabled true
1817
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1918
}
2019
buildFeatures {
2120
dataBinding = true
21+
viewBinding = true
2222
}
2323
buildTypes {
2424
release {
@@ -54,28 +54,11 @@ dependencies {
5454
implementation fileTree(dir: "libs", include: ["*.jar"])
5555
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
5656
implementation 'androidx.multidex:multidex:2.0.1'
57-
implementation 'androidx.core:core-ktx:1.3.2'
58-
implementation 'androidx.appcompat:appcompat:1.2.0'
57+
implementation 'androidx.core:core-ktx:1.5.0'
58+
implementation 'androidx.appcompat:appcompat:1.3.0'
5959
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
60-
testImplementation 'junit:junit:4.13.1'
60+
testImplementation 'junit:junit:4.13.2'
6161
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
6262
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6363

64-
}
65-
66-
67-
//
68-
//afterEvaluate {
69-
// project.tasks.all { task ->
70-
// task.doLast {
71-
// task.inputs.files.each { fileTemp ->
72-
// println 'input file:' + fileTemp.absolutePath
73-
// }
74-
//
75-
// println '---------------------------------------------------'
76-
// task.outputs.files.each { fileTemp ->
77-
// println 'output file:' + fileTemp.absolutePath
78-
// }
79-
// }
80-
// }
81-
//}
64+
}

bintray-release.gradle

Lines changed: 0 additions & 40 deletions
This file was deleted.

build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = "1.4.21"
3+
ext.kotlin_version = "1.5.10"
44
repositories {
55
google()
6-
jcenter()
76
mavenCentral()
87
mavenLocal()
98
}
109
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.2'
10+
classpath 'com.android.tools.build:gradle:4.2.1'
1211
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1312
classpath "com.github.qq549631030:android-junk-code:1.0.7"
1413
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
15-
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:2.0.0"
14+
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:2.1.0-RC01"
1615

1716
// NOTE: Do not place your application dependencies here; they belong
1817
// in the individual module build.gradle files
@@ -22,7 +21,7 @@ buildscript {
2221
allprojects {
2322
repositories {
2423
google()
25-
jcenter()
24+
mavenCentral()
2625
}
2726
}
2827

images/after_project.jpg

51.3 KB
Loading

images/after_total.jpg

60.9 KB
Loading

images/before_project.jpg

38 KB
Loading

images/before_total.jpg

57.4 KB
Loading

0 commit comments

Comments
 (0)