Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问支持Proxy系统类的构造函数(<init>)吗? #18

Open
liuyunyicai opened this issue Jan 13, 2019 · 4 comments
Open

请问支持Proxy系统类的构造函数(<init>)吗? #18

liuyunyicai opened this issue Jan 13, 2019 · 4 comments

Comments

@liuyunyicai
Copy link

No description provided.

@dieyidezui
Copy link
Contributor

原则上是支持的,但是没有试过,您可以试一下

@liuyunyicai
Copy link
Author

liuyunyicai commented Feb 25, 2019

用起来是有问题的,比如要hook某一个类的构造函数:

 @Proxy("<init>")
    @TargetClass("com.aa.application.MyWebView")
    public void construct(Context context) {
        Log.e(TAG, "WebView hook" + "construct" + context);
        Origin.callVoid();
    }

最终织入代码:

public class MainActivity extends AppCompatActivity {

    class _lancet {
        private _lancet() {
        }

        @TargetClass("com.aa.application.MyWebView")
        @Proxy("<init>")
        static void com_aa_application_AOPStation_construct(MyWebView myWebView, Context context) {
            String str = AOPStation.TAG;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("WebView hookconstruct");
            stringBuilder.append(context);
            Log.e(str, stringBuilder.toString());
            MainActivity.access$000(myWebView, context);
        }
    }

    static /* synthetic */ void access$000(MyWebView myWebView, Context context) {
        myWebView = new MyWebView(context);
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView((int) R.layout.activity_main);
        _lancet.com_aa_application_AOPStation_construct(r0, this);
    }
}

r0凭空出来的,有问题

@Lok1n8
Copy link

Lok1n8 commented Sep 21, 2023

我也试了 也是这个问题

@zhangjg0201
Copy link

请问这个问题解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants