Sorry for the late confirmation, please refer to this if you are still in trouble
In my case, it was 4.12.1-pre.1, but the solution āyuki_gotoā posted will also work on 4.12.0. (4.12.1-pre.1 is a version with certain dependencies deleted, and the above solution includes explicit dependencies on all problematic packages in 4.12.0.)
2-2. The UnityIAPDependencies.xml file, in my case, was put in Assets/Editor with the cs file containing the class for which OnPreprocessBuild was declared. Iām not sure if thatās the right way to do it. In my case, it was better to keep files together for similar purposes if there was no specific reason.
Thank you for your response. Is it correct for the user to manually modify the OnPreprocessBuild file and create the UnityIAPDependencies.xml file using the provided instructions?
It seems safer to wait until the Unity IAP team resolves the Android Gradle build issues and releases a new version of IAP before building my project.
Because my game is currently live, Iām more worried about causing build errors by manually modifying various files, which would prevent me from updating the game for my users.
And honestly, Iām not even sure if Iām supposed to modify those files myself. This is an issue with the in-app purchase system provided by Unity.
I know the Unity IAP team is working hard under tight deadlines, but I hope they can release a bug-free, perfect version by Googleās final deadline in November.
Thank you for explaining in detail. Following these steps, the build worked perfectly. In-app purchases and Google login are also functioning well. Iām just worried because I fixed it as instructed without fully understanding the root cause. Iām also concerned about potential issues in the future even though it works fine now. Still, everything is working well. Thank you.
Got the same gradle error after upgrading to Unity IAP (In App Purchasing) 4.12.2. Tried with Unity 2022.3.37f1 & 2021.3.40f1, but the error still shows up.
* What went wrong:
A problem occurred configuring project ':unityLibrary'.
> Cannot change dependencies of dependency configuration ':unityLibrary:implementation' after it has been included in dependency resolution.
I also ensured the following settings are correct: In Project Settings:
Custom Main Gradle Template is enabled
Custom Gradle Properties Template is enabled
In EDM4U Android Resolver settings:
Path AndroidManifest.xml is enabled
Use Jetifier is enabled
Path mainTemplate.gradle is enabled
Path gradleTemplate.properties is enabled
Copy and patch settingsTemplate.gradle from 2022.2 is enabled
I tried exporting to Android project, and noticed these lines are the root cause. Looks like it could potentially cause infinite gradle sync loop, which gradle decided to throw error instead. Removing these lines and then put it in the main dependencies works. Hence, I believe this could be a bug from Unity IAP plugin.
// Dependencies for "com.unity.purchasing". This section is automatically generated.
afterEvaluate {
dependencies {
implementation 'com.android.billingclient:billing:6.2.1'
}
}
// End of dependencies for "com.unity.purchasing".