3

Everything is working fine once I added the below dependencies in the Gradle getting the below error

dependency :

implementation 'com.google.firebase:firebase-perf:19.1.0'

Error:

Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-javalite-3.14.0.jar (com.google.protobuf:protobuf-javalite:3.14.0) and jetified-protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)

apply plugin: 'com.android.application'
    
    apply plugin: 'com.google.protobuf'
    
    apply plugin: 'kotlin-android'
    
    apply plugin: 'kotlin-kapt'
    
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'com.google.gms.google-services'  // Google Services plugin
    
    android {
       
        compileSdkVersion 29
        buildToolsVersion "29.0.3"
        defaultConfig {
            applicationId "com.rakuten.myapplication"
            minSdkVersion 21
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled true
                debuggable false
                signingConfig signingConfigs.release
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        dataBinding {
            enabled = true
        }
        kotlinOptions {
            jvmTarget = "1.8"
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    protobuf {
        protoc { artifact = 'com.google.protobuf:protoc:3.10.0' }
        plugins {
            javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
            grpc {
                artifact = 'io.grpc:protoc-gen-grpc-java:1.25.0'
            }
        }
        generateProtoTasks {
            all().each { task ->
                task.plugins {
                    javalite {}
                    grpc { // Options added to --grpc_out
                        option 'lite'
                    }
                }
            }
        }
    }
    dependencies {
        /** For development, select one from two options. START */
        //implementation project(":voiceai") //-> Use voiceai module in this project.
        implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) //-> Use .aar file under app/libs/ folder.
        /** For development, select one from two options. END */
    
        // Android platform
        implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.core:core-ktx:1.2.0'
        implementation 'com.google.android.material:material:1.1.0'
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
    
        /** START: For Voice_AI_SDK.aar */
        // SharedPreference for session management
        implementation "androidx.preference:preference:1.1.1"
        // Retrofit
        implementation 'com.squareup.retrofit2:retrofit:2.6.2'
        implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
        implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
        // gRPC
        implementation 'io.grpc:grpc-okhttp:1.25.0'
        implementation 'io.grpc:grpc-protobuf-lite:1.25.0'
        implementation 'io.grpc:grpc-stub:1.25.0'
        implementation 'javax.annotation:javax.annotation-api:1.3.2'
    
        // jjwt
        api 'io.jsonwebtoken:jjwt-api:0.11.1'
        //implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
        runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.1'
        runtimeOnly('io.jsonwebtoken:jjwt-orgjson:0.11.1') {
            exclude group: 'org.json', module: 'json' //provided by Android natively
        }
    
        /*if (JavaVersion.current().isJava9Compatible) {
            // Workaround for @javax.annotation.Generated
            // see: https://github.com/grpc/grpc-java/issues/3633
            compile("javax.annotation:javax.annotation-api:1.3.1")
        }*/
        /** END: For Voice_AI_SDK.aar */
    
        // For internal use
        debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
        testImplementation ('junit:junit:4.12'){
            exclude group: 'org.hamcrest', module:'hamcrest-core'
        }
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
        implementation 'com.github.bumptech.glide:glide:4.11.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    
    
        implementation 'com.google.firebase:firebase-perf:19.1.0'
    
    
       
Rajan Kali
  • 12,627
  • 3
  • 25
  • 37
Mahi
  • 1,754
  • 2
  • 16
  • 37
  • possible duplicate of this https://stackoverflow.com/questions/62764605/updated-firebase-dependency-and-got-duplicated-protobuf-classes-error – Sandeep dhiman Feb 12 '21 at 10:36
  • @Sandeepdhiman As you can see there is no possible answer on the above link and I just have one firebase dependency so I do not need to upgrade to all – Mahi Feb 12 '21 at 10:40
  • @Mahi did you find any solution for that – Lokesh Apr 19 '21 at 10:30

0 Answers0