I have used smaple Code of Xamarin.Andoird.Support.v7.Cardview though i get an bellow error
Caused by: android.view.InflateException: Binary XML file line #1:
Error inflating class android.support.v7.widget.CardView
Remove Android Support Library v7 CardView component and add it again! Rebuild the project and it's done! you should not be getting this error now!
I tried the same and it worked.
Related
After migration to AndroidX my app crashes after calling Snackbar.make() method. The error looks like
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.internal.SnackbarContentLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.internal.SnackbarContentLayout"
It's strange that internal Snackbar method make() is still trying to access SnackbarContentLayout class in old support package instead new material's one. Please advice what I'm doing wrong.
UPDATE
Finally I found a solution. There is a custom layout in my project which overrides
Snackbar's design_layout_snackbar_include and it had wrong class in root view tag:
<view
xmlns:android="http://schemas.android.com/apk/res/android"
class="android.support.design.internal.SnackbarContentLayout"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
I changed it to com.google.android.material.snackbar.SnackbarContentLayout
ensure that your project is set up to migrate old packages to Androidx by including this in your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
I'm developing Android App and I'amm putting some strings that reach 20,653Bytes in TextView.
When I build and execute on API 22 device, it works. However, When building on API 26 device, IndexOutOfBoundsException error occured like below.
Caused by: android.view.InflateException: Binary XML file line #61: Binary XML file line #61: Error inflating class TextView
Caused by: android.view.InflateException: Binary XML file line #61: Error inflating class TextView
Caused by: java.lang.IndexOutOfBoundsException
How to solve this error? I have to display this text at at time.
I just solved like below.
Save text(formed in html) in String variable, and then,
tvContent.setText(Html.fromHtml(html1));
When I just used strings.xml, it didn't work.
java.lang.RuntimeException: Unable to start activity ComponentInfo{cab.app.book/com.epbit.ccv3.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class android
support.design.widget.NavigationView.
Added design and appcompat library and Tried in all the ways, but unable to solve the issue.
Please help
Your layout's file has an error in line 18.
I have added the library to my project.
Then in XML file I am trying to add the HorizontalListView as the following
<com.devsmart.android.ui.HorizontialListView
android:id="#+id/horizontalList"
android:layout_width="284dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#ddd" />
But it gives the following Exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.golfer/com.golfer.WeatherScreen}: android.view.InflateException: Binary XML file line #256: Error inflating class com.devsmart.android.ui.HorizontialListView
Caused by: android.view.InflateException: Binary XML file line #256: Error inflating class com.devsmart.android.ui.HorizontialListView
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.devsmart.android.ui.HorizontialListView" on path: DexPathList[[zip file "/data/app/com.golfer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.golfer-1, /vendor/lib, /system/lib]]
I have followed the instructions on this site
Any one having any idea about it? Any help?
Replace com.devsmart.android.ui.HorizontialListView by the name of your package +name of the class.
Something like this: com.example.android.MyHorizontalView where com.example.android is the name of your package and MyHorizontalView is the name of the class (that you created).
EDIT
From this post and android developer, you are probably missing a line to declare the namespace of the view. Try adding a line like this one
xmlns:widget="http://schemas.android.com/apk/res/com.mypackage"
In the parent layout (below the line xmlns:android="http://schemas.android.com/apk/res/android")
You can try it the following way,
Add devsmartlib.jar to the libs folder.
Then go to Java Build Path - > Libraries and Add JAR devsmartlib.jar to the project.
Did you add the Lib to your Dependencies? If not, add it!
Edit
Eclipse:
Right-Click on Project-> Build Path-> Configure Build Path-> Libraries-> Check if lib is in there, if not -> add Library.....
I have two custom components, one which I made quite recently, both in Android Studio. The earlier one worked. I followed the same procedure to make the new one but it throws runtime errors when I reach the activity screen during testing.
These are the exception messages, listed in order:
1. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sentient/com.mycompany.MyActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
2. Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class <unknown>
3. java.lang.reflect.InvocationTargetException
4. java.lang.NoClassDefFoundError: com.mycomponent.R$color
Error #4 shows the actual line itself that throws the error, it is part of the constructor of the component:
int color = res.getColor(R.color.progress_gray);
I checked the R file manually, and found the colors (progress_gray is defined in the colors.xml) to be present. I removed the line, and another line throws the error instead (which again depends on the R file to get information).
I have tried cleaning, changing build order in gradle, Make the component separately, and I still can't figure out where the mistake is. Any help is appreciated! Thanks.
can you post the xml file of the custom view?
Check if you have added to your main layout of the custom view xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
I got the solution. The applicationId in build.gradle and the package in the manifest were not matching. Once I changed it, it worked.
Strange though, I had thought that the reason the two were separated was so that they could be named differently. In any case, that was what got it working.