Skip to content

Commit 156109d

Browse files
committed
✨ 适配 R8 全量模式
遇到很奇怪的问题,RollerViewInfo 如果不 keep 或者添加 @SerializedName,启动就会崩溃,崩溃信息只有 ClassCastException,目前不清楚原因
1 parent f870557 commit 156109d

5 files changed

Lines changed: 10 additions & 14 deletions

File tree

build-logic/manager/proguard-rules.pro

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,6 @@
195195
volatile <fields>;
196196
}
197197

198-
# httpdns https://help.aliyun.com/document_detail/435252.html?spm=a2c4g.435261.0.0.ac114b46hmmXJI
199-
-keep class com.aliyun.ams.ipdetector.Inet64Util{*;}
200-
-keep class com.alibaba.sdk.android.**{*;}
201-
-keep class com.ut.**{*;}
202-
-keep class com.ta.**{*;}
203198
#-------------------------------------------------------------------------
204199

205200
#---------------------------------3.与js互相调用的类------------------------

cyxbs-pages/discover/src/androidMain/kotlin/com/cyxbs/pages/discover/network/RollerViewInfo.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.cyxbs.pages.discover.network
22

3+
import com.google.gson.annotations.SerializedName
34
import java.io.Serializable
45

56
/**
@@ -14,7 +15,10 @@ import java.io.Serializable
1415
* keyword : test
1516
*/
1617
data class RollerViewInfo(
17-
val picture_url: String,
18-
val picture_goto_url: String,
18+
@SerializedName("picture_url")
19+
val pictureUrl: String,
20+
@SerializedName("picture_goto_url")
21+
val pictureGotoUrl: String,
22+
@SerializedName("keyword")
1923
val keyword: String,
2024
) : Serializable

cyxbs-pages/discover/src/androidMain/kotlin/com/cyxbs/pages/discover/pages/RollerViewActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class RollerViewActivity : BaseActivity() {
249249
fun startRollerViewActivity(info: RollerViewInfo, context: Context) {
250250
context.startActivity(
251251
Intent(context,RollerViewActivity::class.java)
252-
.putExtra("URL", info.picture_goto_url)
252+
.putExtra("URL", info.pictureGotoUrl)
253253
.putExtra("Key", info.keyword)
254254
)
255255
}

cyxbs-pages/discover/src/androidMain/kotlin/com/cyxbs/pages/discover/pages/discover/adapter/RollerViewInfoAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RollerViewInfoAdapter(
3434
}
3535

3636
val data = list[realPosition]
37-
if (data.picture_goto_url.startsWith("http")) {
37+
if (data.pictureGotoUrl.startsWith("http")) {
3838
RollerViewActivity.startRollerViewActivity(data, iv.context)
3939
}
4040
}
@@ -72,7 +72,7 @@ class RollerViewInfoAdapter(
7272
) {
7373
val data = list[holder.realPosition]
7474
Glide.with(holder.iv)
75-
.load(data.picture_url)
75+
.load(data.pictureUrl)
7676
.placeholder(R.drawable.discover_ic_cyxbsv6)
7777
.error(R.drawable.discover_ic_cyxbsv6)
7878
.into(holder.iv)

gradle.properties

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ org.gradle.caching=true
4343
# https://blog.csdn.net/growing_tree/article/details/106294146
4444
android.injected.testOnly=false
4545

46-
# AGP8 后默认开启 R8 的全量模式,会导致泛型在源文件中也被擦除
47-
android.enableR8.fullMode=false
48-
4946
# 取消 kotlin sourceSets 的默认模板依赖结构
5047
kotlin.mpp.applyDefaultHierarchyTemplate=false
5148

52-
# 这里默认关闭,可以在 local.properties 覆盖打开配置
49+
# 多平台配置,可以在 local.properties 覆盖当前配置
5350
cyxbs.multiplatform.ios=true
5451
cyxbs.multiplatform.web=true
5552
cyxbs.multiplatform.desktop=true

0 commit comments

Comments
 (0)