google-unity / in-app-review

The Google Play In-app Review Plugin for Unity lets you prompt users to submit Play Store ratings and reviews without the inconvenience of leaving your game.
Other
38 stars 6 forks source link

Incompatibility with Google Ad Manager (Android) 22.4.0.0 Gradle requirement #3

Open kocburak opened 8 months ago

kocburak commented 8 months ago

We are using com.google.play.review to show in app review. We got this error after upgrading to com.android.tools.build:gradle:4.2.0 in order to fulfill google ad manager requirement specified here.

Setup:

Unity 2021.3.33f1 Gradle 6.7.1 (different than unity default which was 6.1.1) com.android.tools.build:gradle:4.2.0 (different than unity default which was 4.0.2) UEDM 1.2.178 Applovin Unity 6.1.2 Google Ad Manager (Android) 22.6.0.0 com.google.play.review 2.0.0

Error:

1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.model.ReviewErrorCode found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)
aprius commented 8 months ago

For unity 2021 I recommend using gradle 6.9.3. Or can you provide a repo that reproduces the error? I'll check it.

kocburak commented 7 months ago

I just tried it using gradle 6.9.3 with com.google.play.review 1.8.1 and still got the following error. I will try to create an example project.

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: D:\***l\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.0-runtime (com.google.android.play:core:1.10.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.common.LocalTestingException found in modules jetified-core-1.10.0-runtime (com.google.android.play:core:1.10.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.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.0-runtime (com.google.android.play:core:1.10.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.listener.StateUpdatedListener found in modules jetified-core-1.10.0-runtime (com.google.android.play:core:1.10.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.10.0-runtime (com.google.android.play:core:1.10.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.10.0-runtime (com.google.android.play:core:1.10.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.10.0-runtime (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
     Duplicate class com.google.android.play.core.review.model.ReviewErrorCode found in modules jetified-core-1.10.0-runtime (com.google.android.play:core:1.10.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.10.0-runtime (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)

     Go to the documentation to learn how to Fix dependency resolution errors.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUİLD FAILED in 2m 44s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

mainTemplate.gradle:

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22, Assets/Firebase/Editor/CrashlyticsDependencies.xml:20, Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
        }
        maven {
            url "https://artifact.bytedance.com/repository/pangle" // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
        }
        maven {
            url "https://cboost.jfrog.io/artifactory/chartboost-ads/" // Assets/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml:8
        }
        maven {
            url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
        }
        maven {
            url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
        }
        mavenLocal()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])r
// Android Resolver Dependencies Start
    implementation 'androidx.recyclerview:recyclerview:1.2.1' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:9
    implementation 'com.android.installreferrer:installreferrer:2.2' // Assets/_Scripts/Editor/Dependencies.xml:5
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    // implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:customtabs:28.+' // Assets/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml:7
    implementation 'com.android.support:recyclerview-v7:28.+' // Assets/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml:6
    implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.applovin.mediation:adcolony-adapter:4.8.0.4' // Assets/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:bytedance-adapter:5.7.0.3.0' // Assets/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:chartboost-adapter:9.6.1.0' // Assets/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:facebook-adapter:[6.16.0.2]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:fyber-adapter:8.2.5.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:google-adapter:[22.6.0.0]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
    implementation 'com.applovin.mediation:google-ad-manager-adapter:[22.6.0.0]' // Assets/MaxSdk/Mediation/GoogleAdManager/Editor/Dependencies.xml:5
    implementation 'com.applovin.mediation:inmobi-adapter:10.6.3.0' // Assets/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:ironsource-adapter:7.6.0.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:mintegral-adapter:16.6.31.0' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:unityads-adapter:4.9.2.1' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:vungle-adapter:7.1.0.0' // Assets/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml:4
    implementation 'com.applovin:applovin-sdk:12.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
    implementation 'com.facebook.android:facebook-applinks:[16.0.1,17)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
    implementation 'com.facebook.android:facebook-core:[16.0.1,17)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
    implementation 'com.facebook.android:facebook-gamingservices:[16.0.1,17)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:9
    implementation 'com.facebook.android:facebook-login:[16.0.1,17)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
    implementation 'com.facebook.android:facebook-share:[16.0.1,17)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
    implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' // Assets/_Scripts/Editor/Dependencies.xml:4
    implementation 'com.google.android.gms:play-services-appset:16.0.2' // Assets/GameAnalytics/Editor/Android/Dependencies.xml:4
    // implementation 'com.google.android.gms:play-services-base:16.1.0' // Assets/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml:9
    implementation 'com.google.android.gms:play-services-base:18.2.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.android.instantapps:instantapps:1.1.0' // Assets/GameAnalytics/Editor/Android/Dependencies.xml:3
    implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
    implementation 'com.google.android.play:review:2.0.0' // Assets/GooglePlayPlugins/com.google.play.review/Editor/Dependencies.xml:3
    implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
    implementation 'com.google.firebase:firebase-analytics:21.3.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:11.6.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:11.6.0' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-common:20.3.3' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-config:21.4.1' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
    implementation 'com.google.firebase:firebase-config-unity:11.6.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.4.3' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:13
    implementation 'com.google.firebase:firebase-crashlytics-unity:11.6.0' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
    implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
    implementation 'com.pollfish.mediation:pollfish-max:6.4.0.0' // Assets/PolyFish/Editor/Dependencies.xml:4
    implementation 'com.squareup.picasso:picasso:2.71828' // Assets/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml:5
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
aprius commented 7 months ago

Well if you post an example soon I will easily find where the problem lies

Whyser commented 5 months ago

@kocburak did you solve this issue? Have this as well now.

aprius commented 5 months ago

You can try upgrade a newest EDM4U v1.2.179

Whyser commented 5 months ago

I'm using the latest EDM4U. I've tried only using packages through Git url or importing the .unitypackage and none of it works. I've tried enabling/disabling "Use Jetifier" and it makes no difference. :/

aprius commented 5 months ago

You can provide build error information as well as more specific information about your environment field setup. I will try to reproduce it and try fix this

Whyser commented 5 months ago

Thanks for your quick response.

Using Unity 2021.3.33f1. EDM4U v1.2.179 (tried earlier as well) com.google.play.review:1.8.1

If I downgrade to 1.7.0 which only adds this line to the mainTemplate.gradle: implementation 'com.google.android.play:core:1.10.3' And using this, I can build and get no error when attempting to launch review flow. But I haven't confirmed if App Review popup actually works, since I don't think it always appears when testing locally, maybe you can confirm?

A blank project works. So obviously this is a conflicting plugin/dependency on my side that causing the issue, but is there anyway to workaround this?

This is the exact error that I got when using v1.8.1:

The error: FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':launcher:checkReleaseDuplicateClasses'.

    1 exception was raised by workers: java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0) Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0) Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0) Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-core-common-2.0.0-runtime.jar (com.google.android.play:core-common:2.0.0) Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0) Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0) Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0) Duplicate class com.google.android.play.core.review.model.ReviewErrorCode found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0) Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.10.0-runtime.jar (com.google.android.play:core:1.10.0) and jetified-review-2.0.0-runtime.jar (com.google.android.play:review:2.0.0)

aprius commented 5 months ago

Well if you want to test In-App-Review you need to upload to Google Play Store with internal testing version. Google will limit how often it re-shows it per account so if it shows up once then it will basically work correctly upon release.

aprius commented 5 months ago

@Whyser Not sure but maybe there is a problem with your gradle cache, have you tried clearing the gradle cache at the path C:\Users\...\.gradle

Whyser commented 5 months ago

Thanks for your help, but unfortunately it did not work.

The 1.7.0 did show the review flow after launching on Internal Track though, so I'll go with that version for now.

aprius commented 5 months ago

Okay maybe you can try again when using unity 2022 or newer. We have not recorded any problems in unity 2022