I am making a Flutter android application which uses photo files. First I had all definitions based in one .proto file. But now I had to split the definitions onto multiple files.
With one file my build script worked:
buildscript {
...
dependencies {
...
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
}
}
...
apply plugin: 'com.google.protobuf'
android {
...
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.proto.srcDirs += '../../protos'
}
...
}
protobuf {
protoc {
if (project.hasProperty('protoc_platform')) {
artifact = "com.google.protobuf:protoc:3.18.0:${protoc_platform}"
} else {
artifact = "com.google.protobuf:protoc:3.18.0"
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
}
}
}
}
With the folder structure
project
| - android app
| - android
|- build.gradle
| - protos
myfile.proto
Now I have updated it to
project
| - android app
| - android
|- build.gradle
| - protos
|- shared
|- dependency
- dependency.proto
- myfile.proto
myfile.proto imports dependency.proto, but when I compile the android project I get the error that protos/shared/dependency/dependency.proto is not found.
How must I update the build.gradle file?