有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在出现此错误时修复gradle?

我启动了一个新项目,将fire base cloud:

apply plugin: 'com.安卓.application'
apply plugin: '安卓-apt'

安卓 {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "安卓.example.com.squawker"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "安卓.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    安卓TestImplementation('com.安卓.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.安卓.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.安卓.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.12'

// RecyclerView
implementation 'com.安卓.support:recyclerview-v7:28.0.0'

// Schematic dependencies for ContentProvider
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
implementation 'net.simonvt.schematic:schematic:0.6.3'

// Preferences Dependencies
implementation 'com.安卓.support:preference-v7:28.0.0'

// Firebase dependency
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
}
// Apply the Google Services plugin. Make sure to add the google-services.json file in the app
// folder. You download it from the Firebase console
apply plugin: 'com.google.gms.google-services'

这个错误发生了:

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.安卓.com/r/tools/task-configuration-avoidance. To determine what is calling variant.getJavaCompile(), use -P安卓.debug.obsoleteApi=true on the command line to display a stack trace. Affected Modules: app


共 (2) 个答案

  1. # 1 楼答案

    这可能是因为apt plugin which is already obsolete。因此,您需要删除以下内容:

    apply plugin: 'android-apt'
    

    然后更改以下内容:

    apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
    

    与:

    annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'