Xamarin Toolbar Hamburger Menu Break - android

I'm getting an unhandled exception when I try to access the hamburger menu on my Android simulator. The exception is:
Unhandled Exception: Android.Views.InflateException: Binary XML file line #14: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.ImageView occurred
It was working until very recently, but reverting all my code changes today doesn't fix the problem. I don't think the problem is with my code.
I don't know what I did to cause this, but I was playing around with different Navigation types when the problem came up. Couldn't find relevant information about the error online.

Related

Xamarin Forms android.view.InflateException

I have an app that's been running for years, and suddenly it has started crashing (With new builds).
My findings is that after you have visited a page with a webview the app will crash. Not on the page with the webview but after you left that page.
I get this exception
Android.Views.InflateException: Binary XML file line #1 in se.xx.yy:layout/shellcontent: Binary XML file line #1 in se.xx.yy
Can also see this in the stack trace:
at Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 37: TypedValue{t=0x2/d=0x7f030007 a=13}, theme={InheritanceMap=[id=0x7f10020bse.xx.yy:style/ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f10006cse.xx.yy:style/Base.ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f10006bse.xx.yy:style/Base.ThemeOverlay.AppCompat.Dark, id=0x7f10010ase.xx.yy:style/Platform.ThemeOverlay.AppCompat.Dark
Any advice?
/Lars

Android studio java.lang.NoClassDefFoundError: org/HdrHistogram/EncodableHistogram

I get this error whenever I try anything in the mainActivity.kt file
even in completely new projects (Kotlin)
just hitting enter to jump line brings this error
how do I fix this please ?

Android trying to load a resource that is not declared

I have several crash reports with the following error:
Caused by android.content.res.Resources$NotFoundException: File res/drawable/ic_keyboard_arrow_right_black_24dp.xml from drawable resource ID #0x7f07010b
at android.content.res.Resources.loadDrawable + 2096(Resources.java:2096)
What baffles me is that the app only uses PNG images. There isn't any reference to ic_keyboard_arrow_right_black_24dp.xml in the code, only to ic_keyboard_arrow_right_black_24dp.png. The error only happens in Android 4.
Does anyone have a clue about what may be causing the error?
Its likely a library loading it. Its probably trying to load the icon here: https://github.com/google/material-design-icons/blob/master/hardware/drawable-anydpi-v21/ic_keyboard_arrow_right_black_24dp.xml
If you don't want to find and fix the library, including that file in your build should fix it.

R file for custom component not compiling

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.

Android Runtime Exception: Unable to instantiate activity componentInfo?

i am running a list-fragment program and at run-time i got the below error.
Error:
**02-09 09:03:40.213: ERROR/AndroidRuntime(572): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ni.android.Fragment/ni.android.Fragment.Fragment}: java.lang.ClassNotFoundException: ni.android.Fragment.Fragment in loader dalvik.system.PathClassLoader[/data/app/ni.android.Fragment-1.apk]**
I don't know the reason.My program contains three classes- DetailsFragment.java, FragmentsTitles.java and Shakespear.java can any one help me out please....
At any time if you get an error stating Unable to instantiate activity ComponentInfo
That means your code has some error.
That error will be shown in log cat As Caused by:.........
1.Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment(This indicates that there is an error in xml and the activity has inflating problem.
By this you can know what is the error and if you rectify that error then your problem will be solved.
This blog will solve this issue.
http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17
Thanks
I had this error as well (beginner) and I noticed that I forgot to create the onCreate method in my activity class. Once I created that, the error went away.
If you have like this warning before error:
05-16 10:08:00.033: W/dalvikvm(1695): Unable to resolve superclass of Lmy/fragment/test/FragmentTestActivity; (7)
05-16 10:08:00.076: W/dalvikvm(1695): Link of class 'Lmy/fragment/test/FragmentTestActivity;' failed
Should export android-support-v4 to right to your app:
Configure Java Build Path -> Order And Export tab -> set checkbox android-support-v4.jar
(Maybe need to remove existing one firstly)
Make sure you are not only looking at error logcat ... as the error may be seen using verbose. But I agree with #parameshwar-s

Categories

Resources