我在我的安卓应用程序中使用proto。现在我尝试在firebase-pref.中使用firebase BOM(26.6.0)
当我运行构建,得到重复的类问题。build.gradle -
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation "com.google.firebase:firebase-appindexing"
//implementation "com.google.firebase:firebase-database:19.2.0"
implementation 'com.google.firebase:firebase-database-ktx'
implementation "com.google.firebase:firebase-auth"
implementation "com.google.firebase:firebase-analytics"
implementation ("com.google.firebase:firebase-perf")
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.google.protobuf:protobuf-lite:3.0.1"
}
protobuf {
protoc {
// You still need protoc like in the non-Android case
artifact = 'com.google.protobuf:protoc:3.7.0'
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// In most cases you don't need the full Java output
// if you use the lite output.
remove java
}
task.plugins {
javalite { }
}
}
}
}
sourceSets{
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
}试评
"com.google.protobuf:protobuf-lite:3.0.1"实现和使用实现'com.google.protobuf:protobuf-javalite:3.14.0'
它也不起作用。是否可以建议任何工作,以便我可以使用更新的防火墙以及保持原版使用不变。
发布于 2021-06-28 02:40:49
becase原生质体:3.0.1和原生质体-javalite:3.14.0都有一个名为com.google.protobuf.AbstractMessageLite的类。但是类代码不兼容。有些不同之处如下:
在javalite中:3.14.0 AbstractMessageLite有一个接口
protected interface InternalOneOfEnum {
int getNumber();
}但原生质体中的AbstractMessageLite :3.0.1没有界面.
所以解决这个问题的唯一方法就是删除一个原型。添加、排除(如exclude group: 'com.*.*' )不适用于此问题。
https://stackoverflow.com/questions/66600185
复制相似问题