英文:
Version 28 is the last version of the legacy support library, so we recomand that you migrate to AndroidX libraies
问题
根据文档中的说明,要使用通知功能,我将以下代码行粘贴到 build.gradle
文件中:
implementation 'com.android.support:support-compat:28.0.0'
但是,Android Studio 将其标记为红色,并显示:版本28(适用于Android Pie及更早版本)是传统支持库的最后一个版本,因此我们建议您在使用Android Q及以后版本时迁移到AndroidX库。 请问有人可以告诉我这是什么意思吗?我只是使用它几天。这个测试项目应与Android 5.0兼容,那么这个文档中的向后兼容库有什么问题吗?以下是 build.gradle
文件中的代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "web.php5.anotifikacie"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "com.android.support:support-compat:28.0.0"
}
英文:
According documentation to use Notifications I past this line of code
implementation "com.android.support:support-compat:28.0.0"
to build.gradle file. But Android Studio underlines it by red and says: 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. Can somebody tell me please what it means? I work with it only few days. This test project should be compatible with Android 5.0 so what is the problem with this documented back compatibility library? Here is the code from builde.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "web.php5.anotifikacie"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "com.android.support:support-compat:28.0.0"
}
答案1
得分: 4
> 版本28(适用于Android Pie及更低版本)是传统支持库的最后一个版本,因此我们建议您在使用Android Q及以后的版本时迁移到AndroidX库。
AndroidX
将原始支持库API替换为androidx命名空间中的包。只有包和Maven构件名称发生了更改,类、方法和字段名称没有更改。
您应该使用
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
您应该查阅发布说明
英文:
> 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. Only the package and Maven artifact names changed; class, method, and field names did not change.
You should use
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
You should follow Release Notes
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论