Skip to content

Commit

Permalink
[bugfix] 修改混淆bug,更改首页item顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
owliao committed Apr 9, 2022
1 parent 8e5c81a commit 3f9ed33
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 5 deletions.
27 changes: 27 additions & 0 deletions build_logic/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#####################################################################
#
# 混淆文件因为模块下没有导包,所以会报错,但不影响
#
#####################################################################
#noinspection ShrinkerUnresolvedReference
#基线包使用,生成mapping.txtt
-printmapping mapping.txt
#补丁包使用,应用mapping.txt
Expand All @@ -20,6 +26,7 @@
## EventBus https://github.com/greenrobot/EventBus
-keepattributes *Annotation*
-keepclassmembers class * {
#noinspection ShrinkerUnresolvedReference
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
Expand Down Expand Up @@ -93,6 +100,7 @@
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keepclassmembers,allowobfuscation class * {
#noinspection ShrinkerUnresolvedReference
@com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
Expand Down Expand Up @@ -123,13 +131,21 @@


## hotfix
## Sophix https://help.aliyun.com/document_detail/61082.html
#基线包使用,生成mapping.txt
-printmapping mapping.txt
#生成的mapping.txt在app/build/outputs/mapping/release路径下,移动到/app路径下
#修复后的项目使用,保证混淆结果一致
#-applymapping mapping.txt
#hotfix
-keep class com.taobao.sophix.**{*;}
-keep class com.ta.utdid2.device.**{*;}
-dontwarn com.alibaba.sdk.android.utils.**
#防止inline
-dontoptimize


# ===============

# Rx
-dontwarn sun.misc.**
Expand All @@ -143,6 +159,7 @@
-dontwarn io.rx_cache.internal.**

#ucrop
#ucrop https://github.com/Yalantis/uCrop
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }
Expand All @@ -151,15 +168,20 @@
-keep class com.nineoldandroids.** { *; }


# ===============

# renderscript
-keep class android.support.v8.renderscript.** { *; }

# 高德地图
# 高德地图 https://lbs.amap.com/api/android-sdk/guide/create-project/dev-attention
# 3D 地图
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}

# 定位
-keep class com.amap.api.location.**{*;}
Expand Down Expand Up @@ -255,10 +277,12 @@
public static ** valueOf(java.lang.String);
}
-keepclasseswithmembers class * {
#noinspection ShrinkerUnresolvedReference
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keep class * implements android.os.Parcelable {
#noinspection ShrinkerUnresolvedReference
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class * implements java.io.Serializable {
Expand All @@ -280,6 +304,7 @@

#---------------------------------webview------------------------------------
-keepclassmembers class * extends android.webkit.WebViewClient {
#noinspection ShrinkerUnresolvedReference
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
public boolean *(android.webkit.WebView, java.lang.String);
}
Expand All @@ -304,6 +329,7 @@
-keep class com.uc.** {*;}

-keepclassmembers class * {
#noinspection ShrinkerUnresolvedReference
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
Expand Down Expand Up @@ -332,3 +358,4 @@ public static final int *;
}
-keep,allowshrinking class org.android.agoo.service.* {*;}
-keep,allowshrinking class org.android.spdy.**{*;}

4 changes: 2 additions & 2 deletions build_logic/src/main/kotlin/com.redrock.app.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
//多渠道包的输出目录,默认为new File(project.buildDir,"channel")
outputDir = File(project.buildDir,"channel")
//多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}-${buildTime}
apkNameFormat ="\${appName}-\${versionName}-\${versionCode}-\${flavorName}-\${buildType}-\${buildTime}"
apkNameFormat ="\${appName}-\${versionName}-\${versionCode}-\${flavorName}-\${buildType}"
//快速模式:生成渠道包时不进行校验(速度可以提升10倍以上,默认为false)
fastMode = false
//buildTime的时间格式,默认格式:yyyyMMdd-HHmmss
Expand All @@ -65,7 +65,7 @@ android {
isMinifyEnabled = true
isZipAlignEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "${rootDir}/build_logic/proguard-rules.pro")

signingConfig = signingConfigs.getByName("config")

Expand Down
22 changes: 21 additions & 1 deletion build_logic/src/main/kotlin/cyxbs.library-base.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ext.get
import gradle.kotlin.dsl.accessors._11b1f85c87a6b4d0c16534be4db6fa46.ext
import org.gradle.api.JavaVersion
import org.gradle.kotlin.dsl.kotlin
import versions.AGP
Expand All @@ -14,7 +15,14 @@ android {
publishing {
singleVariant("debug")
}

signingConfigs {
create("config") {
keyAlias = project.ext["secret"]["sign"]["RELEASE_KEY_ALIAS"] as String
keyPassword = project.ext["secret"]["sign"]["RELEASE_KEY_PASSWORD"] as String
storePassword = project.ext["secret"]["sign"]["RELEASE_STORE_PASSWORD"] as String
storeFile = file("$rootDir/build_logic/secret/key-cyxbs")
}
}
defaultConfig {
minSdk = AGP.mineSdk
targetSdk = AGP.targetSdk
Expand All @@ -31,7 +39,19 @@ android {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "${rootDir}/build_logic/proguard-rules.pro")

signingConfig = signingConfigs.getByName("config")

ndk {
// 修改安装包的架构要记得同步修改上面的 Bugly 的 ndk 依赖
abiFilters += listOf("arm64-v8a")
}
}
}
kotlinOptions {
jvmTarget = "1.8"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 配置jvm堆大小,采用并行Gc提速
# https://developer.android.com/studio/build/optimize-your-build?utm_source=android-studio#configure-the-jvm-garbage-collector
# https://docs.gradle.org/current/userguide/performance.html#adjust_the_daemons_heap_size
org.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC
org.gradle.jvmargs=-Xmx4096m -XX:+UseParallelGC

# 并行编译提速
# https://docs.gradle.org/current/userguide/performance.html#parallel_execution
Expand Down
2 changes: 2 additions & 0 deletions module_app/src/main/java/com/mredrock/cyxbs/App.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mredrock.cyxbs

import android.app.Application
import androidx.annotation.Keep
import com.mredrock.cyxbs.common.BaseApp
import com.mredrock.cyxbs.spi.SdkService
import com.mredrock.cyxbs.spi.SdkManager
Expand All @@ -9,6 +10,7 @@ import java.util.*
/**
* Created By jay68 on 2018/8/8.
*/
@Keep
class App : BaseApp(), SdkManager {

private val loader = ServiceLoader.load(SdkService::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* 注意原先Application里不需要再重复初始化Sophix,并且需要避免混淆原先Application类。
* 如有其它自定义改造,请咨询官方后妥善处理。
*/

public class CySophixApplication extends SophixApplication {
private final String TAG = "SophixStubApplication";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ object MoreFunctionProvider {
Function(R.drawable.discover_ic_other_course, R.string.discover_title_other_course, R.string.discover_detail_other_course, StartActivityAfterLogin("同学课表", DISCOVER_OTHER_COURSE)),
Function(R.drawable.discover_ic_map, R.string.discover_title_map, R.string.discover_detail_map, StartActivityImpl(DISCOVER_MAP)),
Function(R.drawable.discover_ic_todo,R.string.discover_title_todo, R.string.discover_detail_todo, StartActivityImpl(DISCOVER_TODO_MAIN)),
Function(R.drawable.discover_ic_bus_track, R.string.discover_title_bus_track, R.string.discover_detail_bus_track, StartActivityImpl(DISCOVER_SCHOOL_CAR)),
Function(R.drawable.discover_ic_empty_classroom, R.string.discover_title_empty_classroom, R.string.discover_detail_empty_classroom, StartActivityImpl(DISCOVER_EMPTY_ROOM)),
Function(R.drawable.discover_ic_my_exam, R.string.discover_title_my_exam, R.string.discover_detail_my_exam, StartActivityAfterLogin("我的考试", DISCOVER_GRADES)),
Function(R.drawable.discover_ic_no_class, R.string.discover_title_no_class, R.string.discover_detail_no_class, StartActivityAfterLogin("没课约", DISCOVER_NO_CLASS)),
Function(R.drawable.discover_ic_bus_track, R.string.discover_title_bus_track, R.string.discover_detail_bus_track, StartActivityImpl(DISCOVER_SCHOOL_CAR)),
Function(R.drawable.discover_ic_school_calendar, R.string.discover_title_school_calendar, R.string.discover_detail_school_calendar, StartActivityImpl(DISCOVER_CALENDAR)),
Function(R.drawable.discover_ic_more_function, R.string.discover_title_more_function, R.string.discover_detail_more_function, StartActivityImpl(DISCOVER_MORE_FUNCTION)))

Expand Down

0 comments on commit 3f9ed33

Please sign in to comment.