I get this error during build:
e: /Users/some/path/SomeClass.java:86: error: cannot find symbol
e:
e: static ConnectionType getConnectionType(Context context) {
e: ^
e: symbol: class ConnectionType
e: location: class SomeClass
Where ConnectionTypeis the class generated by protobuf. This way, it seems that kapt is not allowing the generated classes.
What have i tried?
First I added a plugin kotlin-apt:
apply plugin: 'kotlin-kapt'
Then I added the classes created with brotobuf to the source set:
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.java.srcDirs += 'build/generated/source/proto/main/java'
}
And also I want to create classes before kapt starts working. Therefore, I order gradle tasks this way:
afterEvaluate {
def protoTasks = []
tasks.each { task ->
if (task.name.contains('proto') || task.name.contains('Proto')) {
protoTasks.push(task)
}
}
tasks.each { task ->
if (task.name.startsWith('kapt')) {
task.dependsOn protoTasks
}
}
}
But all this does not help, I still have the same error. How to solve it?
source
share