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

问题描述 投票:0回答:2

我开始了一个新项目并放置了基于火的云:

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "android.example.com.squawker"
        minSdkVersion 16
        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'
        }
    }
}

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

// RecyclerView
implementation 'com.android.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.android.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'

这个错误apeared:

警告:API'variable.getJavaCompile()'已过时,已替换为'variant.getJavaCompileProvider()'。它将在2019年底删除。有关更多信息,请参阅https://d.android.com/r/tools/task-configuration-avoidance。要确定调用variant.getJavaCompile()的内容,请在命令行上使用-Pandroid.debug.obsoleteApi = true来显示堆栈跟踪。受影响的模块:app

java android-studio android-gradle
2个回答
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'

© www.soinside.com 2019 - 2024. All rights reserved.