Noy Oliel
Noy Oliel

Reputation: 1686

warning: The following options were not recognized by any processor: '[room.schemaLocation]'

I got this warning:

warning: The following options were not recognized by any processor: '[room.schemaLocation]'

I've already checked the below links solutions and it seems to be a different problem. I receive the error while working with Android Studio IDE on an Android project. The error popped up after changes to binding variable in xml (changed type from Integer to int due to Unboxing warning and that i actually only require int).

Already checked below solutions:

NetBeans bug 233098

getting-android-studio-gradle-and-android-annotations-working-together

annotationprocessor-option-not-recorgnized-by-any-processor

Upvotes: 29

Views: 22505

Answers (4)

mukwux
mukwux

Reputation: 1316

I had a similar problem with a multi-module project that I added room to. For my project the problem was caused by adding my RoomDatabase derived class to a library module, but configuring the build.gradle of my app module.

The solution is to configure the build.gradle of the module that contains the RoomDatabase derived class.

There are 3 main pieces to the solution:

1. Your RoomDatabase derived class (AppDatabase in this example)

@Database(entities = arrayOf(SomeWidgetEntity::class), version = 50)
abstract class AppDatabase : RoomDatabase() {
  //your code goes here
}

2. In the build.gradle file of the module that contains AppDatabase add the following to the defaultConfig{} section.

defaultConfig {

    javaCompileOptions {
        annotationProcessorOptions {
        arguments = ["room.schemaLocation":
                     "$projectDir/schemas".toString()]
        }
    }

}

3. In the SAME build.gradle file in the dependencies{} section add the dependency for the room compiler.

dependencies {

    //for kotlin based projects (where $room_version is the version of room you're using)
    kapt "androidx.room:room-compiler:$room_version"
    //for java based projects
    annotationProcessor "androidx.room:room-compiler:$room_version"

}

Upvotes: 19

Rumit Patel
Rumit Patel

Reputation: 12479

I faced the same issue. The problem was Hilt version was not compatible with the kotlin version.

You can compare the below code in the project-level build.gradle file.

dependencies {
        classpath 'com.android.tools.build:gradle:8.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20"
        classpath "com.google.dagger:hilt-android-gradle-plugin:2.46.1"
    }

And below code in the module-level build.gradle file.

implementation "com.google.dagger:hilt-android:2.46.1"
kapt "com.google.dagger:hilt-android-compiler:2.46.1"

For more information, You can have a look at Hilt gradle setup.

Upvotes: 0

Viktor Ardelean
Viktor Ardelean

Reputation: 11

For maven add the following in the maven compiler plugin configuration:

                    <annotationProcessorPaths>
                         <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${org.mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>

Upvotes: 0

Noy Oliel
Noy Oliel

Reputation: 1686

I tried deleting the following from the application build.gradle file:

 javaCompileOptions {
    annotationProcessorOptions {
        arguments = ["room.schemaLocation":
                             "$projectDir/schemas".toString()]
    }
}

Then, I ran "rebuild", added the same segment again and the error disappeared. I don't know why it solved the problem but it did.

Note: Rebuilding\cleaning without removing the above gradle definition didn't work for me so it must be removed and added again before rebuilding.

Upvotes: 17

Related Questions