我只是试图插入一帧通过使用图像创建帧动画现在在webp格式下运行良好与下面给出的代码片段上的Android 7.1 Oneplus3但在Android 4.1.1失败(模拟器)与ResourcesNotFoundException说,它无法找到名称为animation.xml的可绘制文件夹中的xml文件。我只是在我的项目中有一个可绘制的文件夹我还添加了vectorDrawables.useSupportLibrary = true
作为stackoverflow线程建议之一,我清理了项目并尝试了android:largeHeap =“true”,尽管图像尺寸太小但错误仍然存在4.1.1 android API。
imageView = (ImageView) findViewById(R.id.animx);
imageView.setBackgroundResource(R.drawable.animation); // error happening here
AnimationDrawable anim = (AnimationDrawable) imageView.getBackground();
anim.start();
提拉/ animation.xml文件看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/spinners1" android:duration="70" />
<item android:drawable="@drawable/spinners2" android:duration="70" />
<item android:drawable="@drawable/spinners3" android:duration="70" />
<item android:drawable="@drawable/spinners4" android:duration="70" />
</animation-list>
什么是崩溃的原因是什么?为什么只发生在Android 4.1.1?如果我使用vectorDrawables.useSupportLibrary = true
作为自Gingerbread以来支持的设备,那么对于较低的Android版本也会有任何兼容性问题? 这将是显而易见的添加,但文件包括图像和XML存在于项目文件。