Supporting different compile SDK version for my library - android

I have a android library for push notifications and with the release of android Oreo and notification channels I moved up my compile SDK version to 26 and started using support library 26.1.0 along with it to support channel features.
Some of my users are still on compile SDK version 25 and are reluctant to move up the compile version to 26. Also as a best practise most of them want have the support library and compile SDK version on same major version.
This is causing and issue for me on how to support multiple compile version. I don't want to maintain different SDKs for different compile sdk version.
Current implementation: I have added support-compat 26 in provided scope and expect the app developer to add it as compile/implemention.
Old versions can be used but concern here is how to manage bug fixes, enhancements and features

Related

How to identify Android Support Library versions in gradle?

Whenever a new Android Support Repository is released, I have to update my dependencies in the app Gradle file.
dependencies {
compile 'com.android.support:support-v4:25.1.1'
}
However, I don't get much of a clue as to what version to add i.e.: 25.1.1 with every release unless I go and check the Recent Support Revisions.
The version shown in the Android SDK Manager: Android Support Repository, revision 44.
I want to know how to get the right version given the revision number of the Android Support Repository during updates.
All other version such as Build tools show the right corresponding versions, only this one stumps me.
You can use the latest.release suffix in for your libraries like this:
compile 'com.android.support:support-v4:latest.release'
It will insure you are always using the latest release version.
The revision number isn't really that important.
The support library major version should match the compileSdk.

Android Studio appcompat library missing again

I have installed Android SDK tools 22.0.1 and 23.0.3
I want to target SDK version 22.
After chasing previous posts here, I found that people got this to work
compile 'com.android.support:appcompat-v7:22.2.1'
However, I am still getting:
Failed to resolve com.android.support:support-v4:22.2.1
So, I add version 4, then I get same error, twice (below each other)
Which is the latest appcompat support library? Where do you find out the latest version?
This is really frustrating...
Thanks
I have installed Android SDK tools 22.0.1 and 23.0.3
That is irrelevant with respect to using appcompat-v7.
I want to target SDK version 22
Assuming that you mean that you want your targetSdkVersion to be 22, that too is irrelevant with respect to using appcompat-v7.
Which is the latest appcompat support library?
Right now, it is 24.1.0.
Where do you find out the latest version?
In your specific case, go to the Android SDK installation on your developer machine. In there, go to extras/android/m2repository/com/android/support/. In there, you will see directories with the names of all the pieces of the Android Support library (e.g., appcompat-v7/). If you go into any of those, you will see the versions that are available to you.
Now, what is disconcerting about your error messages is that you are getting a failure on support-v4, for a version requested by an appcompat-v7 that apparently is found (otherwise, your error would be for appcompat-v7). This suggests that you do not have all of the Android Support library pieces, perhaps due to a failed installation of the Android Repository from the SDK Manager.
What if I want to compile with SdkVersion 22?
That is not a particularly good idea for new development (vs. maintaining some legacy app). But, if that is what you want, you need to choose Android Support library artifact versions in the 22 series. On my machine, it looks like 22.2.1 is the latest of those.
The latest version is 24.1.0.
You can check it here: https://developer.android.com/topic/libraries/support-library/revisions.html
Change to
compileSdkVersion 23
buildToolsVersion "23.0.3"
and change
compile 'com.android.support:appcompat-v7:22.2.1'
to
compile 'com.android.support:appcompat-v7:23.4.0'
if you want to target sdk 22 add/change
defaultConfig {
//
minSdkVersion 16
targetSdkVersion 22
//
}
Although latest version is 24.1.0 but for that you have to update again from sdk-23 to sdk-24

How can i force gradle to use to different versions of a dependency?

I have an Android Studio Project with automated testing using google espresso. But espresso uses the android support library 23.0.1 and my application the version 23.1.1.
Now i want to use the newer version of the library for normal builds and the older one only for test cases.
My problem is that gradle forces me to choose one version of the support library. How can i reconfigure gradle to not abort the build process and ignore the clashing dependencies?
You can use different versions of the support libraries (why?)
For example you can use:
compile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support:support-annotations:23.0.1'

How to get Android Support library 20 revision in sdk

I'm using Android Studio. Everything was going good but I updated Android support library to 22 revision and my application UI is changed and In some Activities app is crash.
I want to downgrade the version of Android support library from 22 revision to 20 revision in SDK so I uninstalled Android support library but when I install it every time 22 revision is installed.
How can I install 20 revision of Android support library?
You can check inside the sdk folder in your pc.
androidsdk\extras\android\m2repository\com\android\support
For each support library you will find all versions available.
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:support-v4:21.0.3'
Pay attention.
If you use the v20+, you have to use the api 21+ to compile your project.
In your app's module there is a build.gradle file. Inside that you will see something like:
compile 'com.android.support:support-v4:xx.x.x'
This is how you dictate which support library is used when compiling the app. You will need to have the version you choose installed in your SDK manager.

Why i can't compile my android project with other APIs

i want to build an android project for API 19 so i choose this API to compile with, but when eclipse create the projects its tells me that some ressources are not found and the R class is not generated. the only way to avoid this errors is to compile with API21
So why i can not use my API 19 in compilation ??
THNKS for all
Compile SDK Version can and should always be set to the latest SDK released. It is target SDK version that you should set to the latest version you've tested your app on.
Eclipse by default includes AppCompat - the part of the Support Library which ensures a consistent look and feel across all API versions v7+ and the newest version, revision 21, compiles against API 21.
So why i can not use my API 19 in compilation ?
be sure to have the api installed:
Window -> Android SDK Manager

Categories

Resources