Error: Program type already present: com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder
Error: Program type already present: com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder
几个小时后,我决定分享我的问题。
(经过数小时的 Whosebug)
根目录build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.binario12.fastpizza"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7: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'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.google.firebase:firebase-config:16.3.0'
implementation 'com.google.android.libraries.places:places:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
transitive = true
}
//Graphic library Material Design
implementation "com.airbnb.android:lottie:2.5.0"
//Recycler view w/ HashMap
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.2.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.google.android.gms:play-services-tagmanager-v4-impl:16.0.7'
//PageSliding
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
///Rating bar
implementation 'me.zhanghai.android.materialratingbar:library:1.3.2'
}
我还尝试使用命令 ./gradlew :app:dependencies 查看依赖关系,我发现 protobuf 存在于 firebase-firestore 和 firebase-auth 中。我试图不使用添加 {exclude group: 'com.google.protobuf'} 的依赖项,但它没有用。
所有依赖项都设置为最新版本。
当我从 :
切换时,问题就开始了
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
至:
implementation 'com.google.android.libraries.places:places:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
进行此项更改。
实施 'com.google.android.libraries.places:places:1.0.0'
到
实施 'com.google.android.libraries.places:places-compat:1.0.0'
已解决
我改了
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
在此:
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.9'){
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.guava'
exclude group: 'io.grpc:grpc-protobuf-lite'
exclude group: 'com.google.protobuf.DescriptorProtos'
}
并添加了
implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.3'
和
multiDexEnabled true
几个小时后,我决定分享我的问题。
(经过数小时的 Whosebug)
根目录build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.binario12.fastpizza"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7: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'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'com.google.firebase:firebase-perf:16.2.3'
implementation 'com.google.firebase:firebase-config:16.3.0'
implementation 'com.google.android.libraries.places:places:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
transitive = true
}
//Graphic library Material Design
implementation "com.airbnb.android:lottie:2.5.0"
//Recycler view w/ HashMap
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.2.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.google.android.gms:play-services-tagmanager-v4-impl:16.0.7'
//PageSliding
implementation 'com.jpardogo.materialtabstrip:library:1.1.1'
///Rating bar
implementation 'me.zhanghai.android.materialratingbar:library:1.3.2'
}
我还尝试使用命令 ./gradlew :app:dependencies 查看依赖关系,我发现 protobuf 存在于 firebase-firestore 和 firebase-auth 中。我试图不使用添加 {exclude group: 'com.google.protobuf'} 的依赖项,但它没有用。
所有依赖项都设置为最新版本。 当我从 :
切换时,问题就开始了implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
至:
implementation 'com.google.android.libraries.places:places:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
进行此项更改。 实施 'com.google.android.libraries.places:places:1.0.0' 到 实施 'com.google.android.libraries.places:places-compat:1.0.0'
已解决
我改了
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
在此:
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.9'){
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.guava'
exclude group: 'io.grpc:grpc-protobuf-lite'
exclude group: 'com.google.protobuf.DescriptorProtos'
}
并添加了
implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.3'
和
multiDexEnabled true