警告:API 'variant.getJavaCompile()' 已过时,已替

WARNING: API #39;variant.getJavaCompile()#39; is obsolete and has been replaced with #39;variant.getJavaCompileProvider()#39;(警告:API variant.getJavaCompile() 已过时,已替换为 variant.getJavaCompileProvider())
本文介绍了警告:API 'variant.getJavaCompile()' 已过时,已替换为 'variant.getJavaCompileProvider()'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同步 Gradle 时突然出现此错误:

Suddenly when Syncing Gradle, I get this error:

警告:API 'variant.getJavaCompile()' 已过时且已被替换为variant.getJavaCompileProvider()".它将在 2019 年底被删除.有关详细信息,请参阅 https://d.android.com/r/tools/任务配置避免受影响的模块:app

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance Affected Modules: app

我有这个应用模块的 build.gradle:

I've got this build.gradle for the app module:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"
    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "..."
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        versionNameSuffix = version_suffix

        [...]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            [...]
        }
        debug {
            [...]
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61"
    implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation "com.android.support:preference-v7:28.0.0"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
    implementation 'com.google.android.material:material:1.0.0-rc02'

    [...]
}

我可以正确编译应用程序,但有点麻烦,而且我认为,某些东西将在 2019 年底停止工作.关于它是什么以及如何解决它的任何想法?

I can compile the app correctly, but it's a bit bothering, and as I see it, something will stop working at the end of 2019. Any ideas of what is it and how to solve it?

推荐答案

此问题现已通过更新 Fabric Gradle 版本 1.30.0 得到修复:

This issue is fixed now with update Fabric Gradle version 1.30.0:

更新发布:2019 年 3 月 19 日

Update release: March 19, 2019

请查看此链接:https://docs.fabric.io/android/changelog.html#march-15-2019

请在项目级 Gradle 中更新您的类路径依赖项:

Please update your classpath dependency in project level Gradle:

buildscript {
    // ... repositories, etc. ...

    dependencies {
        // ...other dependencies ...
        classpath 'io.fabric.tools:gradle:1.30.0'
    }
}

这篇关于警告:API 'variant.getJavaCompile()' 已过时,已替换为 'variant.getJavaCompileProvider()'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)