Skip to content

Commit

Permalink
1、修改混淆规则,保证能混淆更多的类
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyJingFish committed Dec 26, 2024
1 parent eb49757 commit 106f9b0
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlin.reflect.KClass
* [wiki 文档使用说明](https://flyjingfish.github.io/AndroidAOP/zh/AndroidAopPointCut)
*/
@Target(AnnotationTarget.ANNOTATION_CLASS)
@Retention(AnnotationRetention.SOURCE)
@Retention(AnnotationRetention.BINARY)
annotation class AndroidAopPointCut(
/**
*
Expand Down
34 changes: 4 additions & 30 deletions android-aop-core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# AndroidAop必备混淆规则 -----start-----
#-keep class * {
# @androidx.annotation.Keep <fields>;
#}
-keep class * implements kotlin.coroutines.Continuation{
kotlin.coroutines.Continuation getCompletion();
<fields>;
}
-keep class * implements com.flyjingfish.android_aop_annotation.utils.InvokeMethods{
<methods>;
}
-keep class * {
-keepclasseswithmembers class * {
@com.flyjingfish.android_aop_annotation.aop_anno.AopKeep <fields>;
}
-keep class * {
-keepclasseswithmembers class * {
@com.flyjingfish.android_aop_annotation.aop_anno.AopKeep <methods>;
}
-keep class com.flyjingfish.android_aop_annotation.utils.DebugAndroidAopInit{
*;
}
-keep @com.flyjingfish.android_aop_annotation.anno.AndroidAopPointCut class * { *; }
-keep class com.flyjingfish.android_aop_core.utils.AnnotationInit{
*;
}
# AndroidAop必备混淆规则 -----end-----
}
2 changes: 2 additions & 0 deletions app/src/main/java/com/flyjingfish/androidaop/AppSub.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import androidx.annotation.NonNull;

import com.flyjingfish.test_lib.SubApplication;
import com.flyjingfish.test_lib.ToastUtils;

public class AppSub implements SubApplication {
@Override
public void onCreate(@NonNull Application application) {
Log.e("AppSub","--onCreate---");
ToastUtils.INSTANCE.makeText("onCreate-AppSub");
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/flyjingfish/androidaop/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.flyjingfish.test_lib.PermissionRejectListener
import com.flyjingfish.test_lib.TestMatch2
import com.flyjingfish.test_lib.annotation.MyAnno2
import com.flyjingfish.test_lib.mycut.TestParams2
import com.flyjingfish.test_lib.replace.ReplaceLog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -169,6 +170,12 @@ class MainActivity: BaseActivity2(), PermissionRejectListener{
binding.btnDemo4.setOnClickListener { startActivity(Intent(this,FourActivity::class.java)) }
}

override fun onResume() {
super.onResume()
// binding.tvLogcat.text = "日志:(点此清除)\n"
// setLogcat(ReplaceLog.LOG_MAP.toString())
}

@CheckNetwork(toastText = "没有网络呀~~~")
fun toSecondActivity(){
startActivity(Intent(this,SecondActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object ReplaceTestBean {
@AndroidAopReplaceMethod("<init>()")
@JvmStatic
fun getTestBean(testBean: TestBean) : TestBean{
Log.e("ReplaceTestBean","<init>")
val testBean = TestBean()
testBean.name = "replacedTestBean"
return testBean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.flyjingfish.androidaop.databinding.ActivitySecondBinding;
import com.flyjingfish.androidaop.test.MyOnClickListener2;
import com.flyjingfish.test_lib.annotation.MyAnno;
import com.flyjingfish.test_lib.replace.ReplaceLog;

import java.lang.reflect.Method;

Expand Down Expand Up @@ -61,7 +62,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
// }
// }
}

@MyAnno
public void testIntArray(int[] intArray,int[][] intArray1,int[][][] intArray2,int i,Method[] methods,
boolean[] b1,
Expand All @@ -84,6 +84,8 @@ private void onSingleClick() {
@Override
protected void onResume() {
super.onResume();
// binding.tvLogcat.setText("日志:(点此清除)\n");
// setLogcat(ReplaceLog.INSTANCE.getLOG_MAP().toString());
}

@MainThread
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/flyjingfish/androidaop/ThirdActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.flyjingfish.test_lib.annotation.MyAnno4
import com.flyjingfish.test_lib.annotation.MyAnno5
import com.flyjingfish.test_lib.PermissionRejectListener
import com.flyjingfish.test_lib.TestSuspend
import com.flyjingfish.test_lib.replace.ReplaceLog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
Expand All @@ -38,6 +39,7 @@ class ThirdActivity : BaseActivity() , PermissionRejectListener {
super.onCreate(savedInstanceState)
val binding = ActivityThirdBinding.inflate(layoutInflater)
setContentView(binding.root)
ReplaceLog.LOG_MAP.setLength(0)
binding.btnInner0.setOnClickListener {
test0()
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ TestType = 0

androidAop.debugMode = true
androidAop.debugMode.variantOnlyDebug = true
androidAop.reflectInvokeMethod = false
androidAop.reflectInvokeMethod = true
androidAop.reflectInvokeMethod.variantOnlyDebug = false
androidAop.reflectInvokeMethod.static = true
androidAop.reflectInvokeMethod.static = false
androidAop.debugMode.buildConfig = true


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object ReplaceTestMatch {
@AndroidAopReplaceNew
@JvmStatic
fun newTestMatch2(testBean: TestMatch3):TestMatch3{
Log.e("ReplaceTestMatch","AndroidAopReplaceNew=$testBean")
return testBean
}

Expand Down
2 changes: 2 additions & 0 deletions test-lib/src/main/java/com/flyjingfish/test_lib/TestApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.flyjingfish.test_lib

import android.app.Application
import android.util.Log
import com.flyjingfish.test_lib.ToastUtils.makeText

class TestApp :SubApplication {
override fun onCreate(application: Application) {
Log.e("TestApp","--onCreate---")
makeText("onCreate-TestApp")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ object InitCollect {
fun init(application: Application){
Log.e("InitCollect","----init----");
for (collect in Collects) {
Log.e("InitCollect", "----init----Collects=$collect")
collect.onCreate(application)
}
for (sub in collectClazz) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ package com.flyjingfish.test_lib.replace
import android.util.Log
import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceClass
import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceMethod
import java.util.concurrent.ConcurrentHashMap

@AndroidAopReplaceClass("android.util.Log")
object ReplaceLog {
val LOG_MAP = StringBuffer()
@AndroidAopReplaceMethod("int e(java.lang.String,java.lang.String)")
@JvmStatic
fun e( tag:String, msg:String) :Int{
synchronized(LOG_MAP){
LOG_MAP.append("tag=$tag,msg=$msg\n")
}
return Log.e(tag, "ReplaceLog-$msg")
}
}

0 comments on commit 106f9b0

Please sign in to comment.