I have an an android app that is working correctly on 24.0.0 -- below are my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:palette-v7:24.0.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
But I downloaded the most recent SDK, and am interested in upgrading to 24.2.0. Since I need the support libraries, I added com.android.support:support-v4 to the dependencies as follows:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
This causes the following exception:
java.lang.NullPointerException: Attempt to invoke virtual method
'android.graphics.drawable.Drawable[] android.widget.TextView.getCompoundDrawables()'
on a null object reference
at android.support.v4.widget.TextViewCompat.getCompoundDrawablesRelative(TextViewCompat.java:285)
Did I miss something in the documentation that I should do outside of including support-v4 when upgrading? This is my reference: https://developer.android.com/topic/libraries/support-library/features.html#v4
Note: Prior to Support Library revision 24.2.0, there was a single v4 support library. That library was divided into multiple modules to improve efficiency. For backwards compatibility, if you list support-v4 in your Gradle script, your APK will include all of the v4 modules.
Thanks for your help!
Update the Android Support LibraryIn Android Studio, click the SDK Manager icon from the menu bar, launch standalone SDK Manager, select Android Support Repository and click “Install x packages” to update it. Note you will see both Android Support Repository and Android Support Library listed in the SDK Manager.
The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level.
We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well. So all Android apps should now aim to use AndroidX, instead of the old support library.
I get the exact same exception after upgrading to support library revision 24.2.0 and build tools 24.0.2 when trying to inflate a layout that includes a TextInputLayout that does NOT have an EditText inside of it.
If I comment out the TextInputLayout without the EditText inside it, the exception goes away. If this is not possible, I would recommend rolling back to the previous version of the support library until this is resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With