Im trying to use an Android component I found on Github. Using the sample project inside the repository I integrated the component into my app but everytime I run it I get the error: android.view.InflateException: Binary XML file line #8: Error inflating class com.yalantis.flip.sample.views.FontTextView. This FontTextView has been used in the sample project which runs just fine. Im not sure what im doing wrong as I have also copied and pasted their layouts. I thought my images were the problem but I used the original pictures used in the sample application and it still crashed.
Here is the text from my logcat:
`android.view.InflateException: Binary XML file line #8: Error inflating class com.yalantis.flip.sample.views.FontTextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at cc.tungait.voiture.activities.MainActivity$CarsAdapter.getPage(MainActivity.java:117)
at com.yalantis.flipviewpager.adapter.BaseFlipAdapter$MergeAdapter.getView(BaseFlipAdapter.java:124)
at com.yalantis.flipviewpager.view.FlipViewPager.setAdapter(FlipViewPager.java:468)
at com.yalantis.flipviewpager.adapter.BaseFlipAdapter.getView(BaseFlipAdapter.java:72)`
The XML is exactly what's in the sample project:
`
<com.yalantis.flip.sample.views.FontTextView
style="#style/TextView.Nickname"
android:id="#+id/nickname" />
<LinearLayout
android:layout_below="#+id/nickname"
android:id="#+id/interestsPrimary"
style="#style/LinearLayout.Interests">
<com.yalantis.flip.sample.views.FontTextView
style="#style/TextView.Interest"
android:id="#+id/interest_1" />
<com.yalantis.flip.sample.views.FontTextView
style="#style/TextView.Interest"
android:id="#+id/interest_2" />
<com.yalantis.flip.sample.views.FontTextView
style="#style/TextView.Interest"
android:id="#+id/interest_3" />
</LinearLayout>
<LinearLayout
android:layout_below="#+id/interestsPrimary"
android:id="#+id/interestsSecondary"
android:layout_marginTop="5dp"
style="#style/LinearLayout.Interests">
<com.yalantis.flip.sample.views.FontTextView
android:id="#+id/interest_4"
style="#style/TextView.Interest" />
<com.yalantis.flip.sample.views.FontTextView
android:id="#+id/interest_5"
style="#style/TextView.Interest" />
</LinearLayout>
`
You have to change the package name of your FontTextView in your XML like package_name.FontTextView.
Like below
<LinearLayout
android:layout_below="#+id/interestsPrimary"
android:id="#+id/interestsSecondary"
android:layout_marginTop="5dp"
style="#style/LinearLayout.Interests">
<package_name.FontTextView
android:id="#+id/interest_4"
style="#style/TextView.Interest" />
<package_name.FontTextView
android:id="#+id/interest_5"
style="#style/TextView.Interest" />
You have to match the same package name as in your Project.
Try it and let me know if it worked for you
Related
My app crashes when trying to inflate the com.google.android.material.chip.Chipclass.
The dependency i am using is implementation 'com.google.android.material:material:1.0.0'
Here is my XML code
<com.google.android.material.chip.Chip
android:id="#+id/chipActive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chipCornerRadius="5dp"
android:backgroundTint="#color/primaryColor"
android:textColor="#color/primaryTextColor"
android:textAlignment="center"
android:fontFamily="#font/roboto_regular"
android:layout_marginStart="10dp"
android:text="Active"/>
The error I get is
android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class com.google.android.material.chip.Chip
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
I found a question similar to mine on another thread but there was no solution there that was helpful to me. If anyone has any suggestions on how to fix this issue please help me :D
I found the solution just after posting this question. I updated the dependency to implementation 'com.google.android.material:material:1.1.0-alpha02' and now it works fine.
Use Theme <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
Put this code in the chip
android:theme="#style/Theme.MaterialComponents.Light"
I have WebView on my application and I got many same errors on android 7.0 from users while inflating WebView fragment.
Error log:
android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class android.webkit.WebView
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.webkit.WebView
WebView fragment layout:
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background">
<WebView
android:id="#+id/wvAparat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="16dp" />
</android.support.v7.widget.LinearLayoutCompat>
I got this error from these devices:
SM-G950F Android 7.0
SM-J330F Android 7.0
Moto E (4) Plus Android 7.1.1
It's definitely device related. here is a link for more information:
https://www.androidpolice.com/2016/07/20/google-explains-chrome-will-become-webview-android-7-0/
My hunch would be, if you find one of these devices, to check if they have Chrome installed. If not, that's your answer. No idea for a workaround.
I am creating an app in VS 2015 using Xamarin and when running it I get this error
Android.Views.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
This is my XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/food" />
I have the Food.jpg in the drawable folder as it shows up in VS when I select design.
Thanks
I'm trying to use TextInputLayout in my XML, and I'm meeting this error :
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.jechange.moncompte/fr.jechange.moncompte.SignUpActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$styleable;
I've imported the design library, and the support-v7-appcompat library. And I'm using the Theme.AppCompat.Light.NoActionBar theme.
The XML in which I'm using the Text Input Layout contains just something like that:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:res="http://schemas.android.com/apk/res-auto"
style="#style/matchParent">
<android.support.design.widget.TextInputLayout
android:id="#+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
if you are calling layout(containg TextInputLayout) from activity then
nothing just use YouActivityClassName.this in place of getApplicationcontext or YourApplicationClassName.getcontext() or other where you are passing context
I had the same issue fixed here.
Make sure you don't have any other support library import v4 and v7. You can use only the design-support library. Also you should make sure your theme "matchParent" inherit from Theme.AppCompat for all the platform you trying to run.
My issue was only on Lollipop because of the values-21/style.xml.
Hope it will help.
Im my app I want to use this NumberPicker:
https://github.com/SimonVT/android-numberpicker
I've copied the .jar file from this project, build the path in Eclipse, and imported it at my MainActivity class.
My xml file has the following code:
<net.simonvt.widget.NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
But I am getting this error at LogCat:
11-21 15:12:41.486: E/AndroidRuntime(6315): java.lang.RuntimeException: Unable to start activity ComponentInfo{xxxxxxxx.MainActivity}: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315): Caused by: android.view.InflateException: Binary XML file line #138: Error inflating class net.simonvt.widget.NumberPicker
11-21 15:12:41.486: E/AndroidRuntime(6315): at net.simonvt.widget.NumberPicker.<init>(NumberPicker.java:532)
What is happening?
Thank you!
You have to add your lib form java build path. just right click the properties and then find java build path to add your jar.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/net.simonvt.widget.NumberPicker"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<net.simonvt.widget.NumberPicker
android:id="#+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout
Try this.