Android compatibility problem: java. lang. UnsupportedOperationException solution, androidstudio

Source: Internet
Author: User

Android compatibility problem: java. lang. UnsupportedOperationException solution, androidstudio

During Development a few days ago, we encountered such an amazing exception. Some mobile phones could run, but some of them collapsed. Today we sorted out the exception.

First, paste the exception information

E/AndroidRuntime: FATAL EXCEPTION: mainandroid.view.InflateException: Binary XML file line #13: Error inflating class <unknown>at android.view.LayoutInflater.createView(LayoutInflater.java:613)at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)at android.view.LayoutInflater.inflate(LayoutInflater.java:489)at android.view.LayoutInflater.inflate(LayoutInflater.java:396)at com.hy.taotao.utils.GlobalUtils.inflate(GlobalUtils.java:91)at com.hy.taotao.base.BaseFragment.onCreateView(BaseFragment.java:59)...Caused by: java.lang.reflect.InvocationTargetExceptionat java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:417)at android.view.LayoutInflater.createView(LayoutInflater.java:587)at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)?...Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:468)at android.widget.TextView.<init>(TextView.java:944)at android.widget.TextView.<init>(TextView.java:605)at java.lang.reflect.Constructor.constructNative(Native Method)?at java.lang.reflect.Constructor.newInstance(Constructor.java:417)?at android.view.LayoutInflater.createView(LayoutInflater.java:587)?...

I have sorted out the main exception information above. First, let's take a look at this sentence. We can see from the information above that the error is caused by 13 lines of xml files, the reason is that the dimension file cannot find the element type = 0x1 ". Later, my colleague checked N on the Internet and said that the default value is missing in values, and finally found the missing default value...

1. first look at the folder before the error is reported, you can see the file in a part of the values-v19, not on values, while the values-v19 folder is the device of Api19 using the folder under this directory, when the device cannot find the corresponding name values-*To find the files in the default values folder. If the files cannot be found, the above exception occurs.

2. Now that you know the problem, you have to solve it.

1) Back Up All values-**** and delete it.

2) Add the files in the backed-up values-*** to the default values folder.

3. In fact, in the above 2, this method is generally not recommended. If the mobile phone screen is adapted, of course, you cannot only keep the default folder values, but remember to keep it in other values-*Folder elements must be included in the default values folder.

4. After simple processing

Summary:

1. When doing third-party integration and so on, remember: In other values-*Folder elements must be included in the default values folder.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.