My compiledsdkversion is 23. My Android support library has a 24.0.0-alpha1designation at the end of the string which declares it on my gradle app file. Gradle is compiling with errors stating that the support library should not use a different version than the compiledsdkversion.Any ideas on how to get rid of this error. I don't know how to update the compiledsdkversion.
You should use the latest stable version of the Support Library, which is currently 23.2.1 as per the release notes.
Related
Recently I wanted to update my app's dependencies, as I saw new version of com.android.support:appcompat-v7 library came up (27.0.0). After incrementing this lib version, Android Studio underlines this library and shows a popup with error message:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.0.0, 25.2.0. Examples include
com.android.support:animated-vector-drawable:27.0.0 and
com.android.support:support-v13:25.2.0
I've run gradlew app:dependencies command and saw other dependency which uses android support lib but it's older version - 25.2.0. My question is: what should I do? I assume I have to downgrade android support lib version as otherwise I may see No Method Found or No Class Found errors, am I right? Is it possible to include both of these versions somehow, that the library causing conflicts will be still able to use older version?
Thanks for help!
As you wrote already, one way is to downgrade to the lowest version. But I think that as long as you are not using that specific methods that the library with older dependency is using, you should be fine. But for the sake of safety, you should have all the dependecies of the same version
I tried to set the AppCompat version to '25.0.2' and Design version to '25.+'
This was showing as an error under AppCompat, with RunTime crashes as message.
Please let me know if it is possible to have different SDK values.
You should always use the same version for your support libraries.
You can use a different version of support library, but you should not!. Because, as the error says, it will lead to a runtime crash. Why? Because when you using design version to '25.+' it means that you want to use the most recent of version 25 which is 25.3.1. But you use appcompat 25.0.2. It will introduce some bugs because support design is depend on appcompat implicitly. So, when you add the support design dependency, the appcompat will be implicitly included in your dependency.
You can verify that by looking at gradle dependency tree with:
./gradlew app:dependencies
When you using a different support library version for design and appcompat, there is a probability that the design library need an api that is not in the previous appcompat version yet. So, it will lead to a runtime crash.
Basically I have Android app which uses 23.1.1 of the support library(com.android.support:appcompat-v7:) while Im using a library which uses 25.0.0 version. Basically if I update the version and make it to be equal(the project one and the library one) Im getting a lot of null pointer exceptions which is pretty strange because the app works pretty well at the current version(23.1.1). If I force the library to be using the version of the app - there is a compile error because a new things have been added with the new version(25.0.0). Is it possible somehow to say in the build.gradle let`s the app be using the 23.1.1 version of com.android.support:appcompat-v7: and the library to use its(25.0.0) version of com.android.support:appcompat-v7:?
Is it possible somehow to say in the build.gradle let`s the app be using the 23.1.1 version of com.android.support:appcompat-v7: and the library to use its(25.0.0) version of com.android.support:appcompat-v7:?
No, because there is only copy of appcompat-v7 in your app.
Can you try to remove your import of the 23.x.x of the support library .
The version of the support library that is present in your lib will be use .
I have following gradle dependencies in my Android build.gradle file.
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
Declared versions are the current latest stable versions of these libraries(android support library). But Android Studio displays following warning on them.
A newer version of exists than 23.2.1 is available:
24.0.0-alpha1
24.0.0-alpha1 seems to be the newly released developer preview and I don't want to take them as a stable version of libraries. I can suppress or disable this inspection and get rid of the warnings. But doing so will avoid valid future warnings as well.
How can git rid of this warning for the developer previews?. The warning should appear only if valid new stable version of the library exists.
I use Android studio 1.5.1Thanks in advance
Guys from Google has already fixed it, so all that you need to do now is to wait for the next update.
This problem has already been reported here:
https://code.google.com/p/android/issues/detail?id=203321
I'm targeting Android 19 (because that's what my phone is running). I want to add a notification with buttons; it seems the right approach is to use appcompat-v7.app.NotificationCompat.
However, when I add appcompat-v7 from the Android Support repository revision 22.2 (via a build.gradle dependency), it includes a file app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values-v21/values-v21.xml that doesn't compile because it assumes the target is 21+.
I tried deleting that file, but it gets regenerated.
There doesn't seem to be a way to exclude a file from the build.
So, I need to get an older version of the support library or repository, that doesn't include 21 stuff.
I guess I could import all the sources directly (and leave out the v21 stuff), rather than thru the dependency? I'm not clear where to start with that.
I can use the SDK manager to get older versions of the SDK, but it only offers the latest version of the support library.
to directly answer your question it's all that one line on gradle:
compile 'com.android.support:appcompat-v7:22.2.0'
That last part is the version you're getting. 22.2.0 on the example above.
and on this link you can check the revisions numbers:
https://developer.android.com/tools/support-library/index.html#revisions
But you have a fundamentally wrong approach to your issue. You don't have to target the API for the device you have with you. You can easily and safely target the latest API, use the latest AppCompat features and bug fixes.
Lint will give you a warning every time you try to use a feature that is not from your minimumApi, regardless of the targetAPI
In your gradle build file change the dependency to be the 19 version (the version of the library should match the sdk you are compiling with):
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
...
}
Edit: If v19 of the support lib doesn't have NotificationCompat, then you can't use that unless you compile against a later SDK. You can't include a support library with a higher version than your compiled SDK - that's the issue you are running into.
In this case change:
android {
compileSdkVersion 22
...
}
and leave the dependency set to the 22 version of the appcompat support lib