NonSdkApiUsedViolation for LayoutInflater.mConstructorArgs
See original GitHub issueStrictMode Used a non-SDK API
android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/LayoutInflater;->mConstructorArgs:[Ljava/lang/Object;
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredField(Native Method)
at io.github.inflationx.viewpump.ReflectionUtils.getField(ReflectionUtils.java:15)
at io.github.inflationx.viewpump.ViewPumpLayoutInflater.createCustomViewInternal(ViewPumpLayoutInflater.java:194)
at io.github.inflationx.viewpump.ViewPumpLayoutInflater.access$000(ViewPumpLayoutInflater.java:14)
at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2ViewCreator.onCreateView(ViewPumpLayoutInflater.java:405)
at io.github.inflationx.viewpump.FallbackViewCreationInterceptor.intercept(FallbackViewCreationInterceptor.java:11)
at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
at com.ubercab.presidio.font.core.FontOverrideViewpumpInterceptor.intercept(FontOverrideViewpumpInterceptor.java:31)
at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
at io.github.inflationx.calligraphy3.CalligraphyInterceptor.intercept(CalligraphyInterceptor.java:18)
at io.github.inflationx.viewpump.InterceptorChain.proceed(InterceptorChain.java:37)
at io.github.inflationx.viewpump.ViewPump.inflate(ViewPump.java:49)
at io.github.inflationx.viewpump.ViewPumpLayoutInflater$PrivateWrapperFactory2.onCreateView(ViewPumpLayoutInflater.java:385)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:186)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at io.github.inflationx.viewpump.ViewPumpLayoutInflater.inflate(ViewPumpLayoutInflater.java:55)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Updates to non-SDK interface restrictions in Android 10
A list of blocked non-SDK interfaces (dark greylist) that could not be used if your app targeted API level 28 or higher. Starting...
Read more >xamarin - No field mConstructorArgs in class Landroid/view ...
I got the following response: You need 6.4.1. No known workarounds maybe except for copying all the necessary code to fix that layout...
Read more >LayoutInflater Class (Android.Views) | Microsoft Learn
A constructor used when creating managed representations of JNI objects; called by the runtime. Create a new LayoutInflater instance that is a copy...
Read more >LayoutInflater: Friend or Foe? - Realm Academy
Chris covers how the LayoutInflater works, and how Calligraphy hacks the lifecycle to inject into views at inflation time.
Read more >core/java/android/view/LayoutInflater.java - Google Git
to use LayoutInflater with an XmlPullParser over a plain XML file at runtime; ... final Object[] mConstructorArgs = new Object[2];. @UnsupportedAppUsage.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kanamares mind opening a separate issue for that? It seems like just a signature change rather than a non-sdk API issue. Unlikely we can do much about it before sources are released
@MajaTrzebiatowska when we get source code for that, we can re-visit to confirm, hopefully that new API will be cleaner than this fix, but I would like to see what they have done before making a change like that. (But I’m very glad they added that API, was super dumb setting a field to update the context inside a method you are calling).
This fix in place is much better than the previous attempt as we just force createView to use the context we supply to the LayoutInflater.