From d5906193fa1628f64aa3dfd8aed017e6f22d6437 Mon Sep 17 00:00:00 2001 From: Denis Mondon Date: Mon, 30 Oct 2017 21:09:19 +0100 Subject: [PATCH] v1.0.3 fix nullpointerexception on some devices --- README.md | 2 +- build.gradle | 5 +++-- demo/build.gradle | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 4 ++-- library/build.gradle | 16 ++++++++-------- .../EasyAnimatedVectorDrawable.java | 4 ++++ 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f11ec14..e21b010 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Download ```groovy dependencies { - compile 'com.blunderer:easy-animated-vector-drawable:1.0.2' + compile 'com.blunderer:easy-animated-vector-drawable:1.0.3' } ``` diff --git a/build.gradle b/build.gradle index 775421d..f93d608 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,7 +16,7 @@ buildscript { allprojects { repositories { jcenter() - maven { url 'https://maven.google.com' } + google() } } diff --git a/demo/build.gradle b/demo/build.gradle index 75e6bba..0e0f520 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 - buildToolsVersion "26.0.1" + compileSdkVersion 27 + buildToolsVersion "27.0.0" defaultConfig { applicationId "com.blunderer.easyanimatedvectordrawabledemo" minSdkVersion 14 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" } @@ -23,7 +23,7 @@ android { } dependencies { - compile 'com.android.support:appcompat-v7:26.0.1' + implementation 'com.android.support:appcompat-v7:27.0.0' - compile project(':library') + implementation project(':library') } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7bfa121..dbf8c0a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Sep 28 10:46:06 CEST 2017 +#Mon Oct 30 20:22:41 CET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index 2d75915..b217a9d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 26 - buildToolsVersion "26.0.1" + compileSdkVersion 27 + buildToolsVersion "27.0.0" defaultConfig { minSdkVersion 14 - targetSdkVersion 26 - versionCode 3 - versionName "1.0.2" + targetSdkVersion 27 + versionCode 4 + versionName "1.0.3" vectorDrawables.useSupportLibrary = true } buildTypes { @@ -23,14 +23,14 @@ android { } dependencies { - compile 'com.android.support:appcompat-v7:26.0.1' - compile 'com.wnafee:vector-compat:1.0.5' + implementation 'com.android.support:appcompat-v7:27.0.0' + api 'com.wnafee:vector-compat:1.0.5' } ext { PUBLISH_GROUP_ID = 'com.blunderer' PUBLISH_ARTIFACT_ID = 'easy-animated-vector-drawable' - PUBLISH_VERSION = '1.0.2' + PUBLISH_VERSION = '1.0.3' } apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle' \ No newline at end of file diff --git a/library/src/main/java/com/blunderer/easyanimatedvectordrawable/EasyAnimatedVectorDrawable.java b/library/src/main/java/com/blunderer/easyanimatedvectordrawable/EasyAnimatedVectorDrawable.java index 6c13d5e..80902fe 100644 --- a/library/src/main/java/com/blunderer/easyanimatedvectordrawable/EasyAnimatedVectorDrawable.java +++ b/library/src/main/java/com/blunderer/easyanimatedvectordrawable/EasyAnimatedVectorDrawable.java @@ -66,6 +66,10 @@ private static void setImageDrawable(@NonNull ImageView imageView, @DrawableRes return; } Drawable drawable = ResourcesCompat.getDrawable(imageView.getContext(), drawableResId); + if (drawable == null) { + Log.e(TAG, "The drawable with id " + drawableResId + " is null"); + return; + } if (Build.VERSION.SDK_INT != Build.VERSION_CODES.M) { drawable = drawable.mutate(); }