-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] [Android] Kotlin error on Unity 2021.3.41f1 #703
Comments
Thanks for bringing this up, @victor-kallai. Yeah, that's interesting, the AGP versions should be independent of the minSdkVersion, so the new changes shouldn't affect this, but looks like this isn't the case. We'll investigate this more and come back here once we have updates to share. |
@argzdev Hello! I'm sure you guys working on your maximum, but is it there any status update? Deadline for Google Play is August 31 to increase the target SDK to v34. We managed to build the project with 2021.3.42f1 and min SDK 24, but increasing min version is almost not possible in our case, due to big amount of users on that versions. |
Sorry, we're still investigating this, @vladyslav-androshchuk. While waiting for a fix, regarding the deadline for Google Play, you may request an extension as discussed in the Unity forum:
|
Thank you! We'll make request for all our apps. |
I did a bit of testing, and I noticed something odd. Whenever I export the project, and open it in Android Studio, the issue goes away. With a little bit of tinkering around in the Unity Editor settings, I noticed that enabling I believe the underlying cause could be that the r8 tool with this version of AGP might be faulty. |
Just tried this and it worked! even keeping min api SDK to 22 :D Thanks a lot for taking the time with this, really helped! |
Unfortunately, this work around does not work for us. Our binary builds and runs but only shows a black screen after the initial splash screen. |
Hi @argzdev, we don’t actually use Unity-jar-resolver internally, we export to Android studio and then build from there (so no MCVE). We are seeing the same r8 error: Additionally, changing the minimum sdk version does work (certainly not an ideal solution). As you mentioned, I believe this is the actual issue:
As for the minify errors, the game is (unsurprisingly) unable to find specific classes as they have been stripped. My company has opened a premium support ticket with Unity regarding this issue, if there are any updates I’ll happily share them here. |
Thanks for the additional information, @DevSean. From my testing, the |
@argzdev Thanks for the suggestion, I had considered manually increasing the template versions to see if the issue gets resolved, previously we were able to build targeting API 34 with an older Unity version and an older Gradle version. For obvious reasons we would prefer to match the versions provided by Unity if possible. Either way, I hope this all gets resolved soon. Thank you for your investigations and findings also. |
After I enabled minify debug/release we also had runtime errors for missing classes. I didn't mention it in my previous post but you probably need to add a custom proguard file to prevent those classes from being stripped.
And depending on what classes are missing you will have to add them. For me it was regarding google ads and ump so I added :
You might be already aware of this and your error might be something else, but just incase someone else finds this |
@argzdev Thank you for the fix, enabling the Setting the But I'm happy that it works with To not have any classes stripped by proguard I set this in the custom
|
Awesome, glad that works @victor-kallai. Thanks for sharing your update and extra details for the fix! Since the r8 tooling is embedded in this version of AGP, we can only rely on this workaround until the AGP and Gradle version is raised to version 8+, which isn't anytime soon. That said, there's not much we can do on the unity-jar-resolver side. I'll go ahead and close this thread for now. If anyone has better mitigations, feel free to share! Thanks! |
In case it helps someone, this is another workaround that can be tried:
|
[REQUIRED] Please fill in the following fields:
2021.3.41f1
1.2.182
UMP
Android Resolver
Firebase 12.1.0
,Admob
,Facebook
,GoogleSignIn
,GoogleMobileAds
Windows
[REQUIRED] Please describe the issue here:
I'm raising this issue for better visibility. I know you are already aware of this issue from [here].(#699 (comment))
When building on Android with Unity 1.2.182 the build fails with
ERROR:D8: com.android.tools.r8.kotlin.H
.The temporary fix is to change the
minSdkVersion
from 22 to 24, but that is not desirable.I have in the project
Firebase 12.1.0
,Admob
,Facebook
,GoogleSignIn
,GoogleMobileAds
.Please answer the following, if applicable:
What's the issue repro rate? 100%
What happened? How can we make the problem occur?
apk build fail with error:
ERROR:D8: com.android.tools.r8.kotlin.H
The text was updated successfully, but these errors were encountered: