I had a crash - Resources$NotFoundException for a vector that can be retrieved when an activity is created. Crash on pre-21.
- Android Studio 2.1
- Support Library 24.0.0
- Gradle plugin 2.1.0
- targetSdk 23
- minSdk 15
- buildToolsVersion 23.0.2
- Debugging on sdk 16 emulator
in the build.gradle application module I have:
vectorDrawables.useSupportLibrary = true
This activity is a subclass of AppCompatActivity . Fragment is a subclass of Fragment support.
In the action that I invoke:
static { AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); }
Xml view parameter:
<ImageView android:layout_width="64dp" android:layout_height="match_parent" app:srcCompat="@drawable/ic_map_white_24dp" android:background="@color/vibrant5" android:scaleType="center"/>
Xml portable vector:
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FFffffff" android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
Stacktrace:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.buildware.geoworld/com.buildware.geocoord.activities.DashBoardActivity}: android.view.InflateException: Binary XML file line
I do not see anything that could be wrong. I follow all the recommendations for vectors, but still
android android-support-library appcompat android-vectordrawable
WindRider Jun 23 '16 at 18:29 2016-06-23 18:29
source share