I tried to use the Snap Creative Kit in my android project who is already using Firebase and I can not build due to this error :
Program type already present: com.google.protobuf.Any$1
Firebase Firestore uses protobuf-lite
while Snap Creative Kit uses protobuf-java
. I tried to exclude protobuf-lite
from Firestore but the error persists. When I also exclude com.google.firebase:protolite-well-known-types
from Firestore, the project builds but crashes.
build.gradle (Project)
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://storage.googleapis.com/snap-kit-build/maven"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module:app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.snapchat.kit.sdk:creative:1.0.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
implementation 'com.google.firebase:firebase-storage: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'
}
Problem solved, the last version of Creative Kit resolved this issue. Just change
implementation 'com.snapchat.kit.sdk:creative:1.0.2'
to
implementation 'com.snapchat.kit.sdk:creative:1.1.3'