AndroidAOP icon indicating copy to clipboard operation
AndroidAOP copied to clipboard

Don't know how to get AndroidAOP to work

Open tpkarras opened this issue 4 months ago • 1 comments

Hello.

First time user of AndroidAOP.

I am trying to get AndroidAOP to work but I am unsure of how it works.

I have applied the plugin as specified with it being enabled, build log shows weaving happening.

I have tried @AndroidAOPMatchClass and @AndroidAOPReplaceClass to no avail.

I am trying to get it to output a log message when it intercepts the method.

Code is below.

import android.util.Log; import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceClass; import com.flyjingfish.android_aop_annotation.anno.AndroidAopReplaceMethod; @AndroidAopReplaceClass( "android.app.ActivityThread" ) public class CameraSpoofer { @AndroidAopReplaceMethod( "android.app.ActivityThread currentOpPackageName()" ) public static String currentOpPackageName() { Log.d("Test", "Test"); return "different.package.name"; } @AndroidAopReplaceMethod( "android.app.ActivityThread currentPackageName()" ) public static String currentPackageName() { Log.d("Test2", "Test2"); return "different.package.name"; } }

I am on Windows 11 using Android Studio Jellyfish | 2023.3.1

What am I doing wrong?

tpkarras avatar Oct 13 '24 18:10 tpkarras