【问题标题】:How to fix gradle when this error appear?出现此错误时如何修复gradle?
【发布时间】:2019-07-11 14:43:47
【问题描述】:

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

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'

这个错误出现了:

警告:API 'variant.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-plugin


    【解决方案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'
    

    【讨论】:

    • 做了,同样的问题出现了。
    【解决方案2】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-18
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 2020-02-22
    • 2014-03-01
    相关资源
    最近更新 更多