After solving a JDK zero value error, now I\'m facing this one. I did a little research, but it seems I can\'t get to the point. Here is the log error:
FATA
I ran into this issue in Xamarin.Android with Xamarin.Android.Support.Design 24.0.2. Here is how I solved it:
Added the following line to my Application class OnCreate
:
AppCompatDelegate.CompatVectorFromResourcesEnabled = true;
Replaced:
var upArrow = ContextCompat.GetDrawable(this, Resource.Drawable.abc_ic_ab_back_material);
With:
var upArrow = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.abc_ic_ab_back_material, null);
I tried all the answers above but no success because of clarity most of the time.
Just do this:
At the end the launch_background.xml file should look like below.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/blue" />
<!-- You can insert your own image assets here -->
<item>
<bitmap android:gravity="center" android:src="@drawable/ic_launcher" />
</item>
</layer-list>
I had this problem.
In your Application class, in the onCreate() method, add:
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
... and also use AppCompatImageView
instead of ImageView.
Ex : BaseApplication.class :
public class BaseApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//Your other code here...
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
}
XML :
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/yourIvId"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
I have tried all solutions mentioned above. Nothing worked for me. The only thing worked for me is very simple is to update all support libraries to latest version as this bug has been fixed in it. So i simple did the below thing in gradle file; updated SDK and support to 25.
android {
compileSdkVersion 25
buildToolsVersion "25"
defaultConfig {
targetSdkVersion 25
}
}
In dependencies
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
Not specifically related to your question, but maybe can solve this problem for all that find themselves here while searching for that error.
For me was the problem with SVG file that I have imported into my project. One of the paths in XML has empty pathData
and that was causing the crash on some devices like Pixel XL, Samsung Galaxy S7,...
So double check imported XML for an image if you are using SVG as your image source.
The above methods didn’t work for me. I solved it by adding image of every size and used android:src as well it worked. See the answer here https://stackoverflow.com/a/64537207/11669081