I can't make the xml drawable preview work in Android studio. The program is updated to the latest version (2.2.1), and the sdk too. The preview works with other xml drawables of other build projects I have. The problem is just with this project. I already tried to Invalidate Caches/Restart with no luck. Can someone help me please? I tried everything...
I see this error in the preview tab:
The following classes could not be instantiated: - android.support.v7.widget.AppCompatImageView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.NullPointerException at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:747) at android.content.res.Resources.getValue(Resources.java:1286) at android.support.v7.widget.ResourcesWrapper.getValue(ResourcesWrapper.java:204) at android.support.v7.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:226) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:199) at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:70) at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:42) at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:65) at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:53) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) Copy stack to clipboard Couldn't resolve resource @drawable/ic_data_saver_off (3 similar errors not shown) Failed to convert @drawable/ic_data_saver_off into a drawable (Details) (2 similar errors not shown)
This is one of my drawables not shown in the preview:
<?xml version="1.0" encoding="utf-8"?> <vector android:height="64.0dip" android:width="64.0dip" android:viewportWidth="64.0" android:viewportHeight="64.0" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#e91e63" android:pathData="M62.4,32c0,16.789-13.611,30.4-30.4,30.4S1.6,48.789,1.6,32S15.211,1.6,32,1.6S62.4,15.211,62.4,32z" /> <path android:fillColor="#4dffffff" android:pathData="M34,24v6h6v4h-3.564L30,25.762V24H34z M46,31.8c0,1.8-0.4,3.6-1,5l5.2,3c1.2-2.4,1.8-5.2,1.8-8.2c0-10-8-18.4-18-19.6v6 C40.8,19,46,24.8,46,31.8z M43,40.8c-0.211,0.259-0.445,0.497-0.673,0.74l3.687,4.719c0.785-0.76,1.518-1.58,2.186-2.459L43,40.8z M25.315,19.765c1.429-0.777,3.008-1.318,4.685-1.565V12c-3.11,0.305-5.993,1.324-8.504,2.878L25.315,19.765z M14.034,12.358 l-3.382,2.642l33.315,42.641l3.382-2.642L14.034,12.358z M34.656,45.744C33.794,45.91,32.907,46,32,46c-7.8,0-14-6.2-14-14 c0-2.103,0.486-4.087,1.33-5.873l-4.033-5.162C13.22,24.137,12,27.922,12,32c0,11,9,20,20,20c2.335,0,4.564-0.411,6.644-1.152 L34.656,45.744z" /> </vector> This is the build gradle:
apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.1" defaultConfig { applicationId "bitsykolayers.vividcolorwhite" minSdkVersion 23 targetSdkVersion 24 versionCode 15 versionName "4.0" } buildTypes { def BOOLEAN = "boolean" def TRUE = "true" def FALSE = "false" def ANTI_PIRACY = "ENABLE_ANTI_PIRACY" debug { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField(BOOLEAN, ANTI_PIRACY, FALSE) } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField(BOOLEAN, ANTI_PIRACY, FALSE) } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.github.javiersantos:PiracyChecker:0.0.2' }
No comments:
Post a Comment