我能找到的配置build.gradle以编译 protobufs 的每个示例都使用“lite”版本,看起来像这样:
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.6.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
javalite { }
}
}
}
}
dependencies {
implementation 'com.google.protobuf:protobuf-java:3.6.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
注意“ javalite ”。这会生成使用MessageLite的 java 文件,但我需要完整的Message类。
如何更改它以使其不生成“精简版”版本?