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.

No static method getScreenWidthDp Error

See original GitHub issue

I implemented the library as in the sample and whenever i start the activity containing the fab my app force closes displaying the following error

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.sohail.spoonfulofhyderabad, PID: 15775 java.lang.NoSuchMethodError: No static method getScreenWidthDp(Landroid/content/res/Resources;)I in class Landroid/support/v4/content/res/ConfigurationHelper; or its super classes (declaration of 'android.support.v4.content.res.ConfigurationHelper' appears in /data/app/com.sohail.spoonfulofhyderabad-SJqeyfSr8m7ThbETpbtlWA==/base.apk) at android.support.design.widget.FloatingActionButton.getSizeDimension(FloatingActionButton.java:442) at android.support.design.widget.FloatingActionButton.getSizeDimension(FloatingActionButton.java:434) at android.support.design.widget.FloatingActionButton.onMeasure(FloatingActionButton.java:189) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.joaquimley.faboptions.FabOptions.onMeasure(FabOptions.java:284) at android.view.View.measure(View.java:22002) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) at android.widget.LinearLayout.measureVertical(LinearLayout.java:806) at android.widget.LinearLayout.onMeasure(LinearLayout.java:685) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514) at android.widget.LinearLayout.measureVertical(LinearLayout.java:806) at android.widget.LinearLayout.onMeasure(LinearLayout.java:685) at android.view.View.measure(View.java:22002) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:721) at android.view.View.measure(View.java:22002) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2410) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1498) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
sohail77commented, Jan 15, 2018

I found the solution, there was no issue with the library I just needed to update my support dependency in gradle

1reaction
danielidtcommented, Aug 30, 2018

Ok guys, I think i fixed it. I had to add implementation 'com.android.support:appcompat-v7:26.0.2' to my dependencies in file app/build.gradle

I was using compileSdkVersion = 27 and found that I could keep that as well. it also works with compileSdkVersion = 26

It also works with other versions of implementation 'com.android.support:appcompat-v7:{version}' included as long as 26.0.2 or 26.0.1 is in there also. Not sure what the best configuration is since im not an android dev but wanted to share the solution i found.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoSuchMethodError: No static method ... - GitHub
NoSuchMethodError: No static method getScreenWidthDp #1425 ... implementing React Native Firebase I get the following error at runtime:.
Read more >
java.lang.NoSuchMethodError: No static method getFont ...
After I updated my Android Studio to 3.0 I am getting No static method getFont() error. The project on which I am working...
Read more >
Kotlin SAM Runtime Error - No static method
Basically, the issue happens when referencing a SAM interface that is defined in a super class A via a subclass B . Then...
Read more >
Detaching should fix the Android support library versions?
Hi, I'm not an expert Android developer but I had some troubles in ... No static method getScreenWidthDp(Landroid/content/res/Resources;)I ...
Read more >
java.lang.NoSuchMethodError: No static method - androidx ...
I am getting the error since 6 days ago, with no new release or code changes, and old versions of the app going...
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