Reputation: 399
It shows this error whenever I try to sync the Gradle. Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream
I'm using AndroidStudio 3.1.3. I also followed the documentation on Firebase on how to get started but it dosen't work. I have tried to search and I couldn't get much information. I read about excluding the protobuf but it dosen't really work too.Thanks in advance for the help.
Also apparently commenting out the line with Firestore works so the issue is something with the Firestore dependency.
Below is my build.gradle for app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
//on laptop
//buildToolsVersion "26.0.2"
defaultConfig {
applicationId "application_id_name(sanitized)"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
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'
api 'com.google.android.gms:play-services-vision:15.0.0'
api 'com.android.support:multidex:1.0.3'
api 'com.google.cloud:google-cloud-storage:1.27.0'
implementation 'com.google.firebase:firebase-firestore:17.0.2'
implementation 'com.jjoe64:graphview:4.2.2'
}
apply plugin: 'com.google.gms.google-services'
And here is my build.gradle for the project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
//classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Got this error when trying to exclude protobuf.Could not find method com.google.firebase:firebase-firestore:17.0.2() for arguments [build_60vj88gllutj4zz7i0ca1ojkd$_run_closure2$_closure7@3b52fa7d] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
implementation 'com.google.firebase:firebase-firestore:17.0.2'{
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
Upvotes: 0
Views: 1273
Reputation: 80934
Upgrade this:
classpath 'com.google.gms:google-services:3.2.1'
to this:
classpath 'com.google.gms:google-services:4.0.1'
to be able to use the latest version of firebase libraries.
After executing the ./gradlew :app:dependencies
, you can see that both 'com.google.firebase:firebase-firestore:17.0.2'
and 'com.google.cloud:google-cloud-storage:1.27.0'
are depending on protobuf
, thus leading to this problem.
Since Op is not using google-cloud-storage
then removing 'com.google.cloud:google-cloud-storage:1.27.0'
fixed this issue.
Upvotes: 1