Closed MirkoWu closed 11 months ago
on Android 12,crash by: java.lang.NoSuchMethodError: No direct method <init>()V in class Landroid/content/res/TypedArray; or its super classes (declaration of 'android.content.res.TypedArray' appears in /system/framework/framework.jar)
I cannot instantiate RestringTypedArray。 log:Accessing hidden method Landroid/content/res/TypedArray;-><init>()V (blocked, linking, denied)
You can fix this error by including the following library in your project: FreeReflection.
I would not really recommend using TypedArray
s with Restring though, it will be a bit hacky and hard to implement. You can use the Reword
ViewTransformer
API instead, see here how to use it for custom views. Or just use getString(...)
as usual if you have access to the source code of the custom view you want to use with Restring.
Solved I guess, feel free to reopen if you have further questions :)
In short the java compiler doesn't check if your package directive matches the actual file location. You can use this "feature" in all kinds of ways, many other java/kotlin features are based on this fact.
Originally posted by @B3nedikt in https://github.com/B3nedikt/restring/issues/111#issuecomment-1300535042