Skip to content

Commit d734c26

Browse files
committed
升级agp至8.8.1; 升级kotlin至2.1.10; 升级ksp至2.1.10-1.0.30; 升级协程至1.10.1
1 parent 9859dd2 commit d734c26

File tree

15 files changed

+233
-154
lines changed

15 files changed

+233
-154
lines changed

app/build.gradle

+55-66
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
plugins {
2-
id 'com.android.application'
3-
id 'kotlin-android'
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
44
id 'kotlin-kapt'
5-
// id 'dagger.hilt.android.plugin'
6-
id 'com.google.devtools.ksp' version "$ksp_version"
7-
// id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.10'
5+
id 'com.google.devtools.ksp' version libs.versions.ksp
86
}
97

108
android {
119

1210
namespace 'com.example.httpsender'
1311

14-
compileSdk 34
12+
compileSdk 35
1513
defaultConfig {
1614
applicationId "com.example.rxhttp"
1715
minSdk 21
18-
targetSdk 34
16+
targetSdk 35
1917
versionCode 1
2018
versionName "1.0"
2119

@@ -51,76 +49,67 @@ android {
5149
}
5250

5351
ksp {
54-
arg("rxhttp_rxjava", rxjava_version)
52+
arg("rxhttp_rxjava", libs.versions.rxjava.get())
5553
// arg("rxhttp_package", "rxhttp")
5654
}
5755

5856
kapt {
5957
arguments {
60-
arg("rxhttp_rxjava", rxjava_version) //可传入rxjava2、rxjava3或具体版本号,如 3.1.1
58+
arg("rxhttp_rxjava", libs.versions.rxjava.get()) //可传入rxjava2、rxjava3或具体版本号,如 3.1.1
6159
// arg("rxhttp_package", "rxhttp") //设置RxHttp相关类的包名,多module依赖时,需要配置不同的包名
6260
}
6361
}
6462

6563

66-
//configurations.all {
67-
// resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
68-
//}
69-
7064
dependencies {
71-
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
72-
implementation 'androidx.multidex:multidex:2.0.1'
73-
implementation 'androidx.appcompat:appcompat:1.7.0'
74-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
75-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
76-
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
77-
implementation "androidx.fragment:fragment-ktx:1.6.2"
78-
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
79-
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
80-
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
81-
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
82-
83-
implementation project(":rxhttp")
84-
ksp project(':rxhttp-compiler')
85-
// kapt project(':rxhttp-compiler')
86-
// implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
87-
88-
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
89-
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
90-
91-
// implementation "com.github.liujingxing.rxhttp:rxhttp:$rxhttp_version"
92-
// ksp "com.github.liujingxing.rxhttp:rxhttp-compiler:$rxhttp_version"
93-
// kapt "com.github.liujingxing.rxhttp:rxhttp-compiler:$rxhttp_version"
65+
implementation libs.androidx.multidex
66+
implementation libs.androidx.appcompat
67+
implementation libs.androidx.recyclerview
68+
implementation libs.androidx.constraintlayout
69+
implementation libs.github.magicindicator
70+
implementation libs.androidx.fragment.ktx
71+
implementation libs.androidx.lifecycle.runtime.ktx
72+
implementation libs.androidx.lifecycle.livedata.ktx
73+
implementation libs.androidx.lifecycle.viewmodel.ktx
74+
implementation libs.androidx.lifecycle.service
75+
76+
implementation projects.rxhttp
77+
ksp projects.rxhttpCompiler
78+
// kapt projects.rxhttpCompiler
79+
80+
implementation libs.okhttp
81+
testImplementation libs.mockwebserver
82+
83+
// implementation libs.rxhttp
84+
// ksp libs.rxhttp.compiler
85+
// kapt libs.rxhttp.compiler
9486

9587
//管理RxJava及生命周期,Activity/Fragment 销毁,自动关闭未完成的请求
96-
implementation "com.github.liujingxing.rxlife:rxlife-rxjava3:$rxlife_version"
97-
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
98-
implementation "io.reactivex.rxjava3:rxjava:$rxjava_version"
99-
100-
// implementation "com.github.liujingxing.rxhttp:converter-serialization:$rxhttp_version"
101-
// implementation "com.github.liujingxing.rxhttp:converter-fastjson:$rxhttp_version"
102-
// implementation "com.github.liujingxing.rxhttp:converter-jackson:$rxhttp_version"
103-
// implementation "com.github.liujingxing.rxhttp:converter-moshi:$rxhttp_version"
104-
// implementation "com.github.liujingxing.rxhttp:converter-protobuf:$rxhttp_version"
105-
// implementation "com.github.liujingxing.rxhttp:converter-simplexml:$rxhttp_version"
106-
107-
implementation project(':rxhttp-converter:converter-serialization')
108-
implementation project(':rxhttp-converter:converter-fastjson')
109-
implementation project(':rxhttp-converter:converter-simplexml')
110-
implementation project(':rxhttp-converter:converter-protobuf')
111-
implementation project(':rxhttp-converter:converter-moshi')
112-
implementation project(':rxhttp-converter:converter-jackson')
113-
114-
testImplementation 'junit:junit:4.13.2'
115-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
116-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
117-
implementation 'com.blankj:utilcodex:1.31.1'
118-
119-
testImplementation "com.github.tschuchortdev:kotlin-compile-testing-ksp:1.6.0"
120-
testImplementation 'com.squareup:kotlinpoet:1.18.1'
121-
testImplementation 'com.squareup:kotlinpoet-ksp:1.18.1'
122-
testImplementation project(':rxhttp-compiler')
123-
124-
// implementation "com.google.dagger:hilt-android:2.48.1"
125-
// ksp "com.google.dagger:hilt-android-compiler:2.48.1"
88+
implementation libs.github.rxlife.rxjava3
89+
implementation libs.rxandroid
90+
implementation libs.rxjava
91+
92+
// implementation libs.rxhttp.converter.serialization
93+
// implementation libs.rxhttp.converter.fastjson
94+
// implementation libs.rxhttp.converter.jackson
95+
// implementation libs.rxhttp.converter.moshi
96+
// implementation libs.rxhttp.converter.protobuf
97+
// implementation libs.rxhttp.converter.simplexml
98+
99+
implementation projects.rxhttpConverter.converterSerialization
100+
implementation projects.rxhttpConverter.converterFastjson
101+
implementation projects.rxhttpConverter.converterSimplexml
102+
implementation projects.rxhttpConverter.converterProtobuf
103+
implementation projects.rxhttpConverter.converterMoshi
104+
implementation projects.rxhttpConverter.converterJackson
105+
106+
testImplementation libs.junit
107+
androidTestImplementation libs.androidx.junit
108+
androidTestImplementation libs.androidx.espresso.core
109+
implementation libs.utilcodex
110+
111+
testImplementation libs.kotlin.compile.testing.ksp
112+
testImplementation libs.kotlinpoet
113+
testImplementation libs.kotlinpoet.ksp
114+
testImplementation projects.rxhttpCompiler
126115
}

app/src/main/java/com/example/httpsender/MainActivity.java

+21
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
import android.content.Context;
44
import android.graphics.Color;
55
import android.os.Bundle;
6+
import android.view.View;
7+
import android.view.ViewGroup.LayoutParams;
68
import android.view.animation.AccelerateInterpolator;
79
import android.view.animation.DecelerateInterpolator;
810

11+
import androidx.activity.EdgeToEdge;
12+
import androidx.annotation.NonNull;
913
import androidx.appcompat.app.AppCompatActivity;
14+
import androidx.core.graphics.Insets;
15+
import androidx.core.view.OnApplyWindowInsetsListener;
16+
import androidx.core.view.ViewCompat;
17+
import androidx.core.view.WindowInsetsCompat;
1018
import androidx.databinding.DataBindingUtil;
1119
import androidx.fragment.app.Fragment;
1220

@@ -40,7 +48,20 @@ public class MainActivity extends AppCompatActivity {
4048
@Override
4149
protected void onCreate(Bundle savedInstanceState) {
4250
super.onCreate(savedInstanceState);
51+
EdgeToEdge.enable(this);
4352
mBinding = DataBindingUtil.setContentView(this, R.layout.main_activity);
53+
ViewCompat.setOnApplyWindowInsetsListener(mBinding.getRoot(), new OnApplyWindowInsetsListener() {
54+
@NonNull
55+
@Override
56+
public WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowInsetsCompat insets) {
57+
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
58+
mBinding.magicIndicator.setPadding(0, systemBars.top, 0, 0);
59+
LayoutParams layoutParams = mBinding.magicIndicator.getLayoutParams();
60+
layoutParams.height = (int) (getResources().getDisplayMetrics().density * 50 + systemBars.top);
61+
mBinding.magicIndicator.setLayoutParams(layoutParams);
62+
return insets;
63+
}
64+
});
4465
mBinding.viewPager.setOffscreenPageLimit(4);
4566
mDataList.add("RxJava");
4667
mDataList.add("Await");

build.gradle

+4-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,4 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
3-
buildscript {
4-
5-
ext.kotlin_version = '2.0.0'
6-
7-
repositories {
8-
google()
9-
mavenCentral()
10-
}
11-
12-
dependencies {
13-
classpath 'com.android.tools.build:gradle:8.7.3'
14-
// classpath 'com.google.dagger:hilt-android-gradle-plugin:2.48.1'
15-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16-
}
17-
}
18-
19-
//plugins {
20-
// id("com.google.devtools.ksp") version "$ksp_version" apply false
21-
//}
22-
23-
tasks.register('clean', Delete) {
24-
delete rootProject.layout.buildDirectory
25-
}
1+
plugins {
2+
alias(libs.plugins.android.application) apply false
3+
alias(libs.plugins.kotlin.android) apply false
4+
}

gradle.properties

+1-16
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,4 @@ org.gradle.jvmargs=-Xmx1536m
1717
#org.gradle.daemon=true
1818
#org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
1919

20-
jdk_version=8
21-
22-
okhttp_version=4.12.0
23-
rxjava_version=3.1.8
24-
rxlife_version=2.2.2
25-
rxhttp_version=3.3.1
26-
27-
lifecycle_version=2.8.3
28-
ksp_version=2.0.0-1.0.24
29-
30-
fastjson_version=1.2.76
31-
jackson_version=2.17.2
32-
moshi_version=1.15.1
33-
protobuf_version=4.27.2
34-
kotlinx_serialization_version=1.7.1
35-
simple_xml_version=2.7.1
20+
jdk_version=8

gradle/libs.versions.toml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[versions]
2+
agp = "8.8.1"
3+
kotlin = "2.1.10"
4+
android = "4.1.1.4"
5+
appcompat = "1.7.0"
6+
constraintlayout = "2.2.0"
7+
fastjson = "1.2.76"
8+
fragment = "1.8.6"
9+
gson = "2.11.0"
10+
jacksonCore = "2.17.2"
11+
javapoet = "1.13.0"
12+
junit = "4.13.2"
13+
junitVersion = "1.2.1"
14+
espressoCore = "3.6.1"
15+
kotlinCompileTestingKsp = "1.6.0"
16+
kotlinpoet = "1.18.1"
17+
kotlinxCoroutinesAndroid = "1.10.1"
18+
kotlinxSerializationJson = "1.8.0"
19+
lifecycleRuntime = "2.8.7"
20+
magicindicator = "1.7.0"
21+
moshi = "1.15.1"
22+
multidex = "2.0.1"
23+
okhttp = "4.12.0"
24+
protobufJava = "4.27.2"
25+
recyclerview = "1.4.0"
26+
rxandroid = "3.0.2"
27+
rxhttp = "3.3.1"
28+
rxjava = "3.1.8"
29+
rxlifeRxjava3 = "2.2.2"
30+
simpleXml = "2.7.1"
31+
utilcodex = "1.31.1"
32+
ksp = "2.1.10-1.0.30"
33+
34+
[libraries]
35+
android = { module = "com.google.android:android", version.ref = "android" }
36+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
37+
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
38+
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
39+
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment" }
40+
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
41+
androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleRuntime" }
42+
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntime" }
43+
androidx-lifecycle-service = { module = "androidx.lifecycle:lifecycle-service", version.ref = "lifecycleRuntime" }
44+
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleRuntime" }
45+
androidx-multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
46+
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
47+
rxhttp = { module = "com.github.liujingxing.rxhttp:rxhttp", version.ref = "rxhttp" }
48+
rxhttp-compiler = { module = "com.github.liujingxing.rxhttp:rxhttp-compiler", version.ref = "rxhttp" }
49+
rxhttp-annotation = { module = "com.github.liujingxing.rxhttp:rxhttp-annotation", version.ref = "rxhttp" }
50+
rxhttp-converter-fastjson = { module = "com.github.liujingxing.rxhttp:converter-fastjson", version.ref = "rxhttp" }
51+
rxhttp-converter-jackson = { module = "com.github.liujingxing.rxhttp:converter-jackson", version.ref = "rxhttp" }
52+
rxhttp-converter-moshi = { module = "com.github.liujingxing.rxhttp:converter-moshi", version.ref = "rxhttp" }
53+
rxhttp-converter-protobuf = { module = "com.github.liujingxing.rxhttp:converter-protobuf", version.ref = "rxhttp" }
54+
rxhttp-converter-serialization = { module = "com.github.liujingxing.rxhttp:converter-serialization", version.ref = "rxhttp" }
55+
rxhttp-converter-simplexml = { module = "com.github.liujingxing.rxhttp:converter-simplexml", version.ref = "rxhttp" }
56+
fastjson = { module = "com.alibaba:fastjson", version.ref = "fastjson" }
57+
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
58+
jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations", version.ref = "jacksonCore" }
59+
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jacksonCore" }
60+
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jacksonCore" }
61+
javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" }
62+
junit = { module = "junit:junit", version.ref = "junit" }
63+
kotlin-compile-testing-ksp = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version.ref = "kotlinCompileTestingKsp" }
64+
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
65+
kotlinpoet-javapoet = { module = "com.squareup:kotlinpoet-javapoet", version.ref = "kotlinpoet" }
66+
kotlinpoet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlinpoet" }
67+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
68+
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
69+
github-magicindicator = { module = "com.github.hackware1993:MagicIndicator", version.ref = "magicindicator" }
70+
mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
71+
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
72+
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
73+
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobufJava" }
74+
rxandroid = { module = "io.reactivex.rxjava3:rxandroid", version.ref = "rxandroid" }
75+
76+
rxjava = { module = "io.reactivex.rxjava3:rxjava", version.ref = "rxjava" }
77+
github-rxlife-rxjava3 = { module = "com.github.liujingxing.rxlife:rxlife-rxjava3", version.ref = "rxlifeRxjava3" }
78+
simple-xml = { module = "org.simpleframework:simple-xml", version.ref = "simpleXml" }
79+
symbol-processing-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
80+
utilcodex = { module = "com.blankj:utilcodex", version.ref = "utilcodex" }
81+
82+
83+
[plugins]
84+
android-application = { id = "com.android.application", version.ref = "agp" }
85+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
86+
87+
88+
89+

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip

rxhttp-compiler/build.gradle

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ apply from: '../maven.gradle'
88

99
dependencies {
1010
implementation fileTree(dir: 'libs', include: ['*.jar'])
11-
implementation 'com.squareup:javapoet:1.13.0'
12-
def kotlinpoet = "1.18.1"
13-
implementation "com.squareup:kotlinpoet:$kotlinpoet"
14-
implementation "com.squareup:kotlinpoet-ksp:$kotlinpoet"
15-
implementation "com.squareup:kotlinpoet-javapoet:$kotlinpoet"
16-
// implementation "com.github.liujingxing.rxhttp:rxhttp-annotation:$rxhttp_version"
17-
implementation project(":rxhttp-annotation")
18-
implementation "com.google.devtools.ksp:symbol-processing-api:$ksp_version"
11+
implementation libs.javapoet
12+
implementation libs.kotlinpoet
13+
implementation libs.kotlinpoet.ksp
14+
implementation libs.kotlinpoet.javapoet
15+
// implementation libs.rxhttp.annotation
16+
implementation projects.rxhttpAnnotation
17+
implementation libs.symbol.processing.api
1918
}
2019

2120
java {

rxhttp-converter/converter-fastjson/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ apply from: '../../maven.gradle'
55

66
dependencies {
77
implementation fileTree(dir: 'libs', include: ['*.jar'])
8-
compileOnly project(":rxhttp")
9-
compileOnly "com.squareup.okhttp3:okhttp:$okhttp_version"
10-
api "com.alibaba:fastjson:$fastjson_version"
8+
compileOnly projects.rxhttp
9+
compileOnly libs.okhttp
10+
api libs.fastjson
1111
}
1212

1313
java {

rxhttp-converter/converter-jackson/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apply from: '../../maven.gradle'
55

66
dependencies {
77
implementation fileTree(dir: 'libs', include: ['*.jar'])
8-
compileOnly project(":rxhttp")
9-
compileOnly "com.squareup.okhttp3:okhttp:$okhttp_version"
10-
api "com.fasterxml.jackson.core:jackson-core:$jackson_version"
11-
api "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
12-
api "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
8+
compileOnly projects.rxhttp
9+
compileOnly libs.okhttp
10+
api libs.jackson.core
11+
api libs.jackson.databind
12+
api libs.jackson.annotations
1313
}
1414

1515
java {

0 commit comments

Comments
 (0)