question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NonSdkApiUsedViolation for LayoutInflater.mConstructorArgs

See original GitHub issue
StrictMode    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:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ZacSweerscommented, May 14, 2019

@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

0reactions
chrisjenxcommented, Jun 7, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found