GradleCompatible error: implementation 'com.android.support:appcompat-v7:28.0.0'

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 以显示更多信息。 受影响的模块:电容器-android

我尝试了

中其他主题中建议的解决方案

有人可以帮我吗?感谢您的宝贵时间!

我的build.gradle(电容器-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()'。可能有用。

祝这个平台好运。 这不是一个直接的解决方案,只是一个小建议。但从现在开始,请不要使用支持库。最近介绍了GoogleAndroid JetPack. The current stable version of Android Studio 3.6.1,默认给大家介绍AndroidX,强烈推荐Google使用

AndroidX - Android 扩展库:来自 AndroidX documentation 您还可以从支持 Android 迁移到 AndroidX。只需按照以下步骤操作:Android Studio > Refactor Menu > Migrate to AndroidX。它独立于 Android SDK 版本。

Android Support Revision 28.0.0可以看出,此版本将是android.support打包下的最后一个功能版本,鼓励开发人员迁移到AndroidX 1.0.0。如果您使用支持库,您可能会在获得支持或解决方案时遇到困难。所以,明智的做法是使用 AndroidX.

选项 1:

实施'com.android.support:appcompat-v7:28.0.0'

实施'com.android.support:support-v4:28.0.0'

而不是

实施'com.android.support:appcompat-v7:28.0.0'

实施'com.android.support:appcompat-v4:28.0.0'

选项 2:

将您的项目迁移到 AndroidX