Last active
November 8, 2019 22:23
-
-
Save xlogix/236663745015e72d4c520dd4853341a8 to your computer and use it in GitHub Desktop.
How to bypass Android’s hidden API restrictions (https://www.xda-developers.com/android-development-bypass-hidden-api-restrictions/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val forName = Class::class.java.getDeclaredMethod("forName", String::class.java) | |
val getDeclaredMethod = Class::class.java.getDeclaredMethod("getDeclaredMethod", String::class.java, arrayOf<Class<*>>()::class.java) | |
val vmRuntimeClass = forName.invoke(null, "dalvik.system.VMRuntime") as Class<*> | |
val getRuntime = getDeclaredMethod.invoke(vmRuntimeClass, "getRuntime", null) as Method | |
val setHiddenApiExemptions = getDeclaredMethod.invoke(vmRuntimeClass, "setHiddenApiExemptions", arrayOf(arrayOf()::class.java)) as Method | |
val vmRuntime = getRuntime.invoke(null) | |
setHiddenApiExemptions.invoke(vmRuntime, arrayOf("L")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment