根据这个答案,我正在尝试在我的应用程序中添加此库Google Play应用程序内评论API并按如下方式使用它
rateTheApp.setOnClickListener {
val manager = ReviewManagerFactory.create(requireContext())
val request = manager.requestReviewFlow()
request.addOnCompleteListener { task ->
if (task.isSuccessful) {
// We got the ReviewInfo object
val reviewInfo = request.result
val flow = manager.launchReviewFlow(requireActivity(), reviewInfo)
flow.addOnSuccessListener {
Log.d(TAG, "flow.addOnSuccessListener: sucess")
}
flow.addOnCompleteListener { _ ->
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
Log.d(TAG, "addOnCompleteListener: ${task.result}")
}
} else {
// There was some problem, continue regardless of the result.
val errorCode = when (val exception = request.exception) {
is ReviewException -> {
exception.errorCode
}
is RuntimeExecutionException -> {
exception.errorCode
}
else -> {
9999
}
}
Log.e(TAG, "errorCode: $errorCode", )
}
}
}
错误日志
Duplicate class com.google.android.play.core.assetpacks.AssetLocation found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackException found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackExtractionService found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackLocation found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackManager found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackManagerFactory found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackState found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackStateUpdateListener found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.AssetPackStates found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.NativeAssetPackStateUpdateListener found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.a found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.aa found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ab found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ac found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ad found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ae found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.af found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ag found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ah found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ai found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.aj found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ak found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.al found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.am found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.an found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ao found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ap found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.aq found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ar found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.as found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.at found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.au found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.av found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.aw found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ax found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ay found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.az found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.b found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ba found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bb found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bc found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bd found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.be found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bf found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bg found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bh found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bi found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bj found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bk found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bl found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bm found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bn found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bo found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bp found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bq found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.br found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bs found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bt found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bu found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bv found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bw found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bx found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.by found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.bz found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.c found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.assetpacks.ca found in modules jetified-asset-delivery-2.0.0-runtime (com.google.android.play:asset-delivery:2.0.0) and jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestCellularDataConfirmation$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestFetch$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestPackStates$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestProgressFlow$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestProgressFlow$1$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestProgressFlow$1$2 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestProgressFlow$1$3 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.AssetPackManagerKtxKt$requestProgressFlow$1$globalSessionListener$1 found in modules jetified-asset-delivery-ktx-2.0.0-runtime (com.google.android.play:asset-delivery-ktx:2.0.0) and jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1)
Duplicate class com.google.android.play.core.ktx.ReviewManagerKtxKt found in modules jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1) and jetified-review-ktx-2.0.0-runtime (com.google.android.play:review-ktx:2.0.0)
Duplicate class com.google.android.play.core.ktx.ReviewManagerKtxKt$requestReview$1 found in modules jetified-core-ktx-1.8.1-runtime (com.google.android.play:core-ktx:1.8.1) and jetified-review-ktx-2.0.0-runtime (com.google.android.play:review-ktx:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
build.gradle(项目)
buildscript {
ext {
// Versions for all the dependencies we plan to use. It's particularly useful for kotlin and
// navigation where the versions of the plugin needs to be the same as the version of the
// library defined in the app Gradle file
kotlin_version = "1.6.21"
version_gradle = "7.3.0"
version_core = "1.8.0"
// version_lifecycle_extensions = "2.2.0"
hilt_version = "2.42"
nav_version = "2.5.2"
room_version = "2.4.3"
version_constraint_layout = "2.2.0-alpha03"
// version_glide = "4.12.0"
version_retrofit = "2.9.0"
version_recyclerview = "1.2.1"
version_material = "1.6.1"
version_play_services = "21.2.0"
}
dependencies {
classpath "com.android.tools.build:gradle:$version_gradle"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.40.1"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
}
}
plugins {
id 'com.android.application' version "$version_gradle" apply false
id 'com.android.library' version "$version_gradle" apply false
id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(应用程序模块)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id "androidx.navigation.safeargs.kotlin"
id 'dagger.hilt.android.plugin'
id 'kotlin-parcelize'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-kapt'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.test.myapp"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
buildFeatures {
viewBinding true
}
kapt {
correctErrorTypes = true
}
namespace 'com.test.myapp'
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation ('com.google.android.material:material:1.6.1')
{
exclude(group: 'androidx.recyclerview', module: 'recyclerview')
exclude(group: 'androidx.recyclerview', module: 'recyclerview-selection')
}
implementation "androidx.recyclerview:recyclerview:1.2.1"
// For control over item selection of both touch and mouse driven selection
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.preference:preference:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
// //Moshi
// implementation("com.squareup.moshi:moshi:1.13.0")
// implementation("com.squareup.retrofit2:converter-moshi:2.9.0")
// kapt "com.squareup.moshi:moshi-kotlin-codegen:1.13.0"
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'org.jsoup:jsoup:1.14.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation "androidx.browser:browser:1.4.0"
implementation 'androidx.multidex:multidex:2.0.1'
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
//Room
implementation "androidx.room:room-runtime:2.4.3"
kapt "androidx.room:room-compiler:2.4.3"
implementation "androidx.room:room-ktx:2.4.3"
androidTestImplementation "androidx.room:room-testing:2.4.3"
//Dagger - Hilt
implementation 'com.google.dagger:hilt-android:2.42'
kapt 'com.google.dagger:hilt-android-compiler:2.42'
//SDP & SSP
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
// Shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'
//firebase & analytics
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.google.firebase:firebase-analytics'
//crashlytics
implementation 'com.google.firebase:firebase-crashlytics'
// DataStore
implementation 'androidx.datastore:datastore-preferences:1.0.0'
implementation("androidx.datastore:datastore-preferences-rxjava3:1.0.0")
//admob
implementation 'com.google.android.gms:play-services-ads:21.2.0'
implementation("androidx.ads:ads-identifier:1.0.0-alpha04")
// Used for the calls to addCallback() in the snippets on this page.
implementation("com.google.guava:guava:28.0-android")
//for fcm
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-iid:21.1.0'
implementation 'com.google.firebase:firebase-messaging:23.0.8'
implementation 'android.arch.work:work-runtime:1.0.1'
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
//
// dependencies {
// // debugImplementation because LeakCanary should only run in debug builds.
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
// }
implementation 'com.google.android.ump:user-messaging-platform:2.0.0'
kapt("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.5.0")
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation("com.google.android.play:asset-delivery-ktx:2.0.0")
implementation 'com.google.android.play:core-ktx:1.8.1'
implementation("com.google.android.play:review-ktx:2.0.0")
}
如果您依赖现已弃用的 Google Play Core 库和新库,就会发生这种情况。
Google Play 核心库现已拆分为多个库。有一个文档页面描述了根据您的需求从“旧”Play Core 库迁移到多个库。页面的其余部分描述了所有可用的 Google Play Core 库。
在你的情况下,你必须删除线
implementation 'com.google.android.play:core-ktx:1.8.1'
并且仅KEEP行(或上面链接的文档页面中列出的任何其他Google Play核心库):
implementation 'com.google.android.play:asset-delivery-ktx:2.0.1'
implementation 'com.google.android.play:review-ktx:2.0.1'
注意:我已将版本更新到撰写本文时的版本,您可能需要将其更新到当前版本。
只需删除
implementation 'com.google.android.play:core-ktx:1.8.1'