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

并不能 hook 未重写方法 #37

Open
siyehua opened this issue Jan 10, 2020 · 2 comments
Open

并不能 hook 未重写方法 #37

siyehua opened this issue Jan 10, 2020 · 2 comments

Comments

@siyehua
Copy link

siyehua commented Jan 10, 2020

 @TargetClass("androidx.appcompat.app.AppCompatActivity")
    @Proxy("onDestroy")
    public void onDestroy() {
        Log.e("siyehua", "onDestroy");
        Origin.callVoid();
    }

如果不重写onDestroy(),则无效

public class Main2Activity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
        setContentView(R.layout.activity_main2);
    }

//    @Override
//    protected void onDestroy() {
//        super.onDestroy();
//    }
}
@dieyidezui
Copy link
Contributor

dieyidezui commented Jan 12, 2020

Insert(mayCreateSuper = true)

@HJWAJ
Copy link

HJWAJ commented Apr 28, 2020

Insert(mayCreateSuper = true)

我加了mayCreateSuper = true,似乎还是没有成功织入。

    @Insert(value = "startActivity", mayCreateSuper = true)
    @TargetClass("xx.xx.MyActivity")
    // @TargetClass(value = "android.support.v4.app.FragmentActivity", scope = Scope.ALL)
    public void hookStartActivity(Intent intent) {
        Origin.callVoid();
        Log.d("hjwaj", "hookStartActivity");
    }

@TargetClass("xx.xx.MyActivity") 时,加不加mayCreateSuper = true都可以织入。
@TargetClass(value = "android.support.v4.app.FragmentActivity")时,不管设置什么scope,不管加不加mayCreateSuper = true,在MyActivity调用startActivity时,都没有成功织入。

版本是1.0.5。

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

3 participants