FreeReflection一个允许你在Android P上使用反射而没有任何限制的库

FreeReflection

FreeReflection is a library that lets you use reflection without any restriction above Android P (includes Q).

Github: https://github.com/tiann/FreeReflection/

Usage

  1. Add dependency to your project(jcenter):
1
implementation 'me.weishu:free_reflection:2.2.0'
  1. Add one line to your Application.attachBaseContext:
1
2
3
4
5
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
Reflection.unseal(base);
}

Then you can use the reflection API normally, all the restrictions are gone. Enjoy yourself :)

Under the hood

free reflection above android p

another way to use reflection api above android p

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :