android - 如何在构建期间摆脱增量注释处理请求警告?

标签 android android-studio kotlin realm

我刚开始使用android开发。我正面临这个警告信息

[kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: io.realm.processor.RealmProcessor (NON_INCREMENTAL).



当我使用这本书作为引用进行编程时,我收到了一个警告。我研究了几种解决方案并尝试了,但找不到解决方案。请给我一些建议。

How to get rid of Incremental annotation processing requested warning?
这个链接是我提到的页面。

这是我的 build.gradle(Modules: app) 文件。
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.matsu.bloodpressure"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.0.0'
    implementation 'io.realm:android-adapters:3.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
}

build.gradles 文件↓
buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:5.1.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


gradles.properties 文件↓
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

最佳答案

您正在使用 Realm-Java 5.1.0。

在 5.11.0 中将增量注释处理添加到 Realm。

您应该尝试更新到 6.1.0,唯一的重大更改是关于 Realm Object Server PermissionManager API,您可能没有使用它,但包含重要的错误修复,如 6.0.1 中关于加密 Realm 的修复。

关于android - 如何在构建期间摆脱增量注释处理请求警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61571947/

相关文章:

android - Android ZXing 库是否存在内存泄漏?

android-studio - 如何在不安装 Android Studio 的情况下运行 Android 模拟

使用 minifyEnabled true 进行 Android 调试

Android Studio 1.1.0 没有从 1.0.0 获取 aar 文件构建的引用

android - 弹出 fragment 时 SharedViewModel 未清除

android - CardViews 未显示在 RecyclerView 中

android 应用程序小部件动态背景颜色与圆角 android 2.3

c# - 将 android 模拟器连接到本地主机 web 服务 [C#]

java - 如何在 Android Studio 项目中添加 Kotlin 类?

kotlin - 所有生产者协程完成后如何关闭 channel ?