如何修复出现此错误时的gradle?
如何修复出现此错误时的gradle?
我启动了一个新的项目并使用了 fire-base cloud:
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
admin 更改状态以发布 2023年5月24日
可能是因为apt插件已经过时。因此,您需要删除以下内容:
apply plugin: 'android-apt'
然后更改以下内容:
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
改为:
annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'