Build issue: Conflicts with Google Protobuf dependency

Facing Issue when adding –
implementation ‘com.google.cloud:google-cloud-vision:3.44.0’ library in gradle facing error as shown in image

Gradle Error code below –

  1. Caused by: java.lang.RuntimeException: Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.41.0 (com.google.api.grpc:proto-google-common-protos:2.41.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)

2.Caused by: com.android.builder.merge.DuplicateRelativeFileException: 2 files found with path 'google/protobuf/empty.proto' from inputs:

3.Caused by: com.android.builder.merge.DuplicateRelativeFileException: 2 files found with path 'google/protobuf/empty.proto'.

I have tried to exclude module also but in that case i am unable to import required classes.

implementation (‘com.google.cloud:google-cloud-vision:3.44.0’){
exclude module : ‘proto-google-common-protos’
exclude module : ‘protolite-well-known-types’
exclude module : ‘protobuf-java’
exclude module : ‘protobuf-javalite’
}

Below is the function and screenshot where i am facing error –

private fun searchProduct(
    segmentedImage: Bitmap,
    x_min: Int,
    y_min: Int,
    x_max: Int,
    y_max: Int,
    half_sku: String
): FloatArray {
    try {
        // Load the credentials from the service account key JSON file
        val credentials: GoogleCredentials =
            GoogleCredentials.fromStream(context.assets.open("caratlane-v4-c3d8e96bfa95.json"))
        val settings: ImageAnnotatorSettings = ImageAnnotatorSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build()
        Log.d("LOOOOOOOOOOOOOOOOOLLLLLLLLL", credentials.toString())
        try {
            ImageAnnotatorClient.create(settings).use { client ->
                // Convert the segmented image to ByteString
                val baos = ByteArrayOutputStream()
                segmentedImage.compress(Bitmap.CompressFormat.JPEG, 100, baos)
                val imgBytes =
                    ByteString.copyFrom(baos.toByteArray())

                // Create an image request
                val image: Image = Image.newBuilder()
                    .setContent(imgBytes)
                    .build()
                val feature: Feature = Feature.newBuilder()
                    .setType(Feature.Type.PRODUCT_SEARCH)
                    .setMaxResults(10)
                    .build()
                //                BoundingPoly boundingPoly = BoundingPoly.newBuilder()

// .addVertices(Vertex.newBuilder().setX(x_min).setY(y_min).build())
// .addVertices(Vertex.newBuilder().setX(x_max).setY(y_min).build())
// .addVertices(Vertex.newBuilder().setX(x_max).setY(y_max).build())
// .addVertices(Vertex.newBuilder().setX(x_min).setY(y_max).build())
// .build();
val imageContext: ImageContext = ImageContext.newBuilder()
.setProductSearchParams(
ProductSearchParams.newBuilder()
.setProductSet(“projects/caratlane-v4/locations/asia-east1/productSets/cl-vs-prod-v6”)
.addProductCategories(“apparel-v2”)
.setFilter(“half_sku=$half_sku”) // .setBoundingPoly(boundingPoly)
.build()
)
.build()

                val request: AnnotateImageRequest = AnnotateImageRequest.newBuilder()
                    .addFeatures(feature)
                    .setImage(image)
                    .setImageContext(imageContext)
                    .build()

                // Perform the request
                val responses: List<AnnotateImageResponse> =
                    client.batchAnnotateImages(listOf(request))
                        .getResponsesList()
                for (response in responses) {
                    if (response.hasError()) {
                        Log.e(
                            "ProductSearch",
                            "Error: " + response.getError().getMessage()
                        )
                    }

                    // Parse and handle the response
                    val results: ProductSearchResults = response.getProductSearchResults()
                    var resultText = ""
                    val floatarr = FloatArray(10)
                    var i = 0
                    for (result in results.getResultsList()) {
                        resultText += result.getScore()
                        floatarr[i] = result.getScore()
                        i++
                        resultText += "n"
                    }
                    //result.setText("nVisual Search Scores:n$resultText")
                    return floatarr
                }
            }
        } catch (e: Exception) {
            Log.d("LOOOOOOOOOOOOOOOOOLLLLLLLLL", e.toString())
        }
    } catch (e: IOException) {
        Log.e("ProductSearch", "Error searching product", e)
    }
    return FloatArray(0)
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật