visual studio xamarin error - android

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

Related

Android studio error inflating constraint layout

Android studio drops
"android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout"
error when i run my app on Android Marshmallow or below. It perfectly works on nougat and oreo
I added "implementation 'com.android.support.constraint:constraint-layout:1.1.0'" as i saw it in other answers but it still not works
xml:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/soros3"
android:padding="0dp"
tools:co0-ntext=".MainActivity">
please help
ok
So I removed the background of the layout and removed the
tools:co0-ntext=".MainActivity"
line and it works.
I don't really know why but it works

Android WebView InflateException on android 7.0

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.

Android Error inflating class TextInputLayout

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.

How to add a jar file in my library project?

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.

android eclipse can't see layer-list in Graphical Layout

i'm trying to build a layer-list of 2 images and to see it in the Graphical layout in eclipse in order to see that it came correctly...
for some reason i get an error
this is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="50dp"
android:layout_height="50dp">
<item android:drawable="#drawable/picuser"
android:layout_width="50dp"
android:layout_height="50dp"/>
<item android:drawable="#drawable/ic_launcher"
android:layout_width="50dp"
android:layout_height="50dp"/>
</layer-list>
this is my error:
NOTE: This project contains Java compilation errors, which can cause rendering failures
for custom views. Fix compilation problems first.
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- item (Fix Build Path, Edit XML)
- layer-list (Fix Build Path, Edit XML)

Categories

Resources