![](/img/trans.png)
[英]implementation 'com.android.support:appcompat-v7:28.0.0' - Error
[英]GradleCompatible error: implementation 'com.android.support:appcompat-v7:28.0.0'
我是android開發的初學者。 當我構建我的 android 項目時,它拋出一個錯誤
信息:API 'variantOutput.getPackageLibrary()' 已過時並已替換為 'variant.getPackageLibraryProvider()'。 它將在 2019 年底移除。有關更多信息,請參閱https://d.android.com/r/tools/task-configuration-avoidance 。 要確定是什么調用了 variantOutput.getPackageLibrary(),請在命令行上使用 -Pandroid.debug.obsoleteApi=true 以顯示更多信息。 受影響的模塊:capacitor-android
我嘗試了在實現“com.android.support:appcompat-v7:28.0.0”的其他主題中建議的解決方案
有人可以幫我嗎? 感謝您的時間!
我的 build.gradle(capacitor-android) 文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.novoda:bintray-release:0.9.1'
}
}
tasks.withType(Javadoc).all { enabled = false }
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
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'
}
}
lintOptions {
abortOnError false
}
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support:appcompat-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
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'
implementation 'org.apache.cordova:framework:7.0.0'
}
def version = System.getenv("BINTRAY_PKG_VERSION")
publish {
userOrg = 'ionic-team'
repoName = 'capacitor'
groupId = 'ionic-team'
artifactId = 'capacitor-android'
if (version != null) {
publishVersion = System.getenv("BINTRAY_PKG_VERSION")
} else {
publishVersion = '0.0.0'
}
desc = 'Capacitor Android Runtime'
website = 'https://github.com/ionic-team/capacitor'
}
將代碼中的 'variantOutput.getPackageLibrary()' 替換為 'variant.getPackageLibraryProvider()'。 它可能有效。
祝這個平台好運。 這不是直接的解決方案,只是一小部分建議。 但從現在開始,請不要使用支持庫。 最近,谷歌推出了Android JetPack 。 當前穩定版本的Android Studio 3.6.1 ,默認情況下會引入 AndroidX,強烈建議谷歌使用。
AndroidX - Android 擴展庫:來自AndroidX 文檔您還可以從支持 Android 遷移到 AndroidX。 只需按照以下步驟操作: Android Studio > Refactor Menu > Migrate to AndroidX
。 它獨立於 Android SDK 版本。
從Android Support Revision 28.0.0可以看出,此版本將是android.support
封裝下的最后一個功能發布,並鼓勵開發人員遷移到 AndroidX 1.0.0。 如果您使用支持庫,您可能會在獲得支持或解決方案時遇到困難。 因此,使用 AndroidX 是明智之舉。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.