当前位置: 首页 > 知识库问答 >
问题:

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

习胤运
2023-03-14

我开始了一个新的项目,并把火基地云:

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的变体。getJavaCompile()已过时,已替换为“variant”。getJavaCompileProvider()。它将于2019年底拆除。有关详细信息,请参阅https://d.android.com/r/tools/task-configuration-avoidance.确定什么是调用变量。getJavaCompile(),使用-Pandroid。调试。命令行上的obsoleteApi=true以显示堆栈跟踪。受影响模块:应用程序

共有2个答案

白宏大
2023-03-14

类似于API的变体。getExternalNativeBuildTasks()已过时,并已替换为“variant”。getExternalNativeBuildProviders()快乐的编码!

司寇烨伟
2023-03-14

这可能是因为apt插件已经过时了。因此,您需要删除以下内容:

apply plugin: 'android-apt'

然后更改以下内容:

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

与:

annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'
 类似资料:
  • 我正在编程一个需要Hibernate技术的项目。我得到了堆栈痕迹,但我不知道如何修复它。有什么需要帮忙的吗? 这是我的堆栈跟踪,我得到了这两个错误: SLF4J:slf4j-api 1.6.x(或更高版本)与此绑定不兼容。SLF4J:您的绑定是1.5.5或更早版本。SLF4J:将绑定升级到1.6.x版本。或2.0.x 导入org.hibernate.hibernateException;导入org

  • 我试图做Java本地接口,这是使用gcc编译c文件和Java代码是 如何修复输出NaN

  • 编辑问题以包括所需的行为、特定问题或错误以及重现问题所需的最短代码。这将有助于其他人回答这个问题。 我正在尝试制作一个minecraft客户端,但当我反编译它时,它说 ==在JAVA代码中发现错误== 初始客户端重新编译失败,请更正源代码,然后运行updatemd5按任意键继续。 我已经安装了java jdk,但是我还需要做什么

  • 我发现了一个mysql创建表语法错误,希望有人能在我失去理智之前发现它。 错误1064(42000):您的SQL语法中有错误;查看与您的MySQL server版本相对应的手册,以了解在第2行“int not null auto_increment,Client_ID int not null,Start_Time varchar(5),star”附近使用的正确语法 mysql Ver 14.14

  • D:\messages_app\chat_app\android\应用程序\src\debug\AndroidManifest.xml 错误: uses-sdk:minSdkVersion 16 不能小于库中声明的版本 19 [:cloud_firestore] D:\messages_app\chat_app\build\cloud_firestore\中间\library_manifest\调