Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What support library version should we use with targetSDK 28?

I was going through this article , it says to update your project's compileSdkVersion and targetSdkVersion to API 28 . So I did but the support library gave error like support library should not use different version than compileSdk version

enter image description here

I tried updating it to 28.0.0 but its not working and says

Failed to resolve: com.android.support:appcompat-v7:28.0.0

I know it will still work with 27.1.1 but what is the correct version to use which won't give red underline ?

EDIT

build.gradle file

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'   

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "in.eightfolds.safety"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

ext.support_version = '28.0.0'
ext.room_version = "1.1.1"
ext.lifecycle_version = "1.1.1"

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    kapt 'com.android.databinding:compiler:3.1.3'

    //Room (remove apply plugin: 'kotlin-kapt'  at top)
    implementation "android.arch.persistence.room:runtime:$room_version"
    kapt "android.arch.persistence.room:compiler:$room_version"

    implementation "com.android.support:design:$support_version"
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    kapt 'com.github.bumptech.glide:compiler:4.6.1'   // for Kotlin
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.pddstudio:encrypted-preferences:1.3.0'
    implementation 'com.nabinbhandari.android:permissions:3.6'

    implementation 'com.google.code.gson:gson:2.8.4'


}

//below part of code credit to https://stackoverflow.com/a/42957234/6478047    

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "$support_version"
            }
        }
    }

}
like image 939
Manohar Avatar asked Jul 03 '18 05:07

Manohar


People also ask

Is the latest version of the Legacy Support library?

Version 28(intended for Android Pie and below) is the last version of the legacy support library, so we recomand that you migrate to AndroidX libraies when using Android Q and moving forward. AndroidX replaces the original support library APIs with packages in the androidx namespace.

What is the Android support library?

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.

Which v7 support libraries are used for modifying UI settings?

v7 Preference Support Library The preference package provides APIs to support adding preference objects, such as CheckBoxPreference and ListPreference , for users to modify UI settings. The v7 Preference library adds support for interfaces, such as Preference. OnPreferenceChangeListener and Preference.


Video Answer


2 Answers

I know this has already been answered but I needed to update mine today as well and neither of the links from the answers above actually told me what to put. So I had to use the following:

implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support:design:28.0.0-rc01'
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc01'
implementation 'com.android.support:support-v4:28.0.0-rc01'
implementation 'com.android.support:support-media-compat:28.0.0-rc01'
implementation 'com.android.support:support-vector-drawable:28.0.0-rc01'

I hope this helps someone else looking for what to put there.

like image 50
user2101081 Avatar answered Oct 20 '22 08:10

user2101081


you can use Revision 28.0.0 Alpha 1 for android p but it is a preview version

Visit https://developer.android.com/topic/libraries/support-library/packages for latest support-libraries

like image 20
puya ars Avatar answered Oct 20 '22 07:10

puya ars