Update 9.2.1 forces to install Android SDK platform 31 and Android SDK Build Tools 30.0.3
[REQUIRED] Step 1: Describe your environment
- Unity version: 2021.3.42f1
- Google Mobile Ads Unity plugin version: 9.2.1
- Plugin installation method: Unity package manager, .unitypackage import
- Platform: Android
- Platform OS version: All
- Any specific devices issue occurs on: All
- Mediation ad networks used, and their versions: None
[REQUIRED] Step 2: Describe the problem
After upgrade to Google Mobile Ads Unity 9.2.1 Unity build fails with the following message:
What went wrong: Could not determine the dependencies of task ':unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl'. Failed to install the following Android SDK packages as some licences have not been accepted. platforms;android-31 Android SDK Platform 31 build-tools;30.0.3 Android SDK Build-Tools 30.0.3 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. All licenses can be accepted using the sdkmanager command line tool: sdkmanager.bat --licenses Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle Using Android SDK: /Applications/Unity2021.3.42/PlaybackEngines/AndroidPlayer/SDK
I think this may happen because of new build.gradle was added for GoogleMobileAdsPlugin.androidlib in 9.2.1
If I additionally install Android SDK Platform 31 and Android SDK Build-Tools 30.0.3 for Unity 2021 then the build completes successfully. By default Unity 2021.3.42f1 has Platforms 33 and 34, and Build-Tools 32.0.0 (https://docs.unity3d.com/2021.3/Documentation/Manual/android-sdksetup.html)
Is it possible for Google Mobile Ads not to depend on those specific platform and build-tools versions?
Steps to reproduce:
Just build the app with default settings
Relevant Code:
This is from build.gradle from GoogleMobileAdsPlugin.androidlib which I think may be the cause of the issue:
apply plugin: 'android-library'
android {
namespace "com.google.unity.ads"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
}
}
Thanks for finding and investigating the issue. We had to add the Gradle file because of #3510. We will look at into fixing this in the upcoming release. You are right in that the Library does not depend specifically on 31 to get it to work. 34 would be more appropriate as GMA Android SDK also depends on API 34.
Does not specifying specific targetSdkVersion of 31 break compatibility with Unity player settings? What if the project targets 34 or 35?
the same issue with Google Mobile Ads Unity plugin version 9.3.0 and Unity 2021.3.45f1
Yeah we didn't update the build.gradle file. We will look to do so in the upcoming 9.4.0 release. In the meantime you can manually update the build.gradle file in GoogleMobileAdsPlugin.androidlib to target API 34. You can find this under Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/build.gradle.
Yeah we didn't update the build.gradle file. We will look to do so in the upcoming 9.4.0 release. In the meantime you can manually update the build.gradle file in GoogleMobileAdsPlugin.androidlib to target API 34. You can find this under Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/build.gradle.
Update manually build.gradle and project.properties to API 34 in GoogleMobileAdsPlugin.androidlib, but the same problem still exists
Yeah we didn't update the build.gradle file. We will look to do so in the upcoming 9.4.0 release. In the meantime you can manually update the build.gradle file in GoogleMobileAdsPlugin.androidlib to target API 34. You can find this under Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/build.gradle.
Update manually build.gradle and project.properties to API 34 in GoogleMobileAdsPlugin.androidlib, but the same problem still exists
Confirming this solution is not working for my project too. (Google Mobile Ads Unity plugin version 9.3.0 and Unity 2021.3.43f1) Here is the error:
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-31 Android SDK Platform 31
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
After manually changing build.gradle and setting target API 34, I get the second line of the error above like this:
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
Have you found any solution or workground for this problem?
Yeah we didn't update the build.gradle file. We will look to do so in the upcoming 9.4.0 release. In the meantime you can manually update the build.gradle file in GoogleMobileAdsPlugin.androidlib to target API 34. You can find this under Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/build.gradle.
After we do your suggestion we continue to get this exception:
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
Maybe something else we need to change somewhere?
Is this the correct edited build.gradle you suggest?
apply plugin: 'android-library'
android {
namespace "com.google.unity.ads"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
compileSdkVersion 34
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
}
}
What about project.properties file? Don't we need to change the target here too?
target=android-31
android.library=true
Any updates for this issue? Can someone help me to use the plugin v9.3.0 and build for Android normally? You have released a plugin with a bug and keep us waiting for the version v9.4.0 without any release date. Does anyone care about the reputation of this product? Millions of developers use it.
Any updates for this issue? Can someone help me to use the plugin v9.3.0 and build for Android normally? You have released a plugin with a bug and keep us waiting for the version v9.4.0 without any release date. Does anyone care about the reputation of this product? Millions of developers use it.
Hope they will fix the issue in the upcoming update.
Any updates for this issue? Can someone help me to use the plugin v9.3.0 and build for Android normally? You have released a plugin with a bug and keep us waiting for the version v9.4.0 without any release date. Does anyone care about the reputation of this product? Millions of developers use it.
Hope they will fix the issue in the upcoming update.
Thank you for response. Did you find some workround to build your project?
Hey, i solved it. Just install what they require in your unity version. Also tested on 2022.3.41
Hey, i solved it. Just install what they require in your unity version. Also tryed on 2022.3.41
Hey, thank you for response. I saw this solution in forums, but is this safe for other plugins?
Hey, i solved it. Just install what they require in your unity version. Also tryed on 2022.3.41
Hey, thank you for response. I saw this solution in forums, but is this safe for other plugins?
still in testing process
any other fixes for this? or do i have to install those ? UPDATE: For me, in Unity 6000.0.23f1 worked by setting the target api to 31, then I made a build and platform - 31 was installed (the build will fail). After that, I added back API level 35 and everything worked.
@dcosmin-97 It worked! Thank you!!
Same Build Error: Admob 9.3.0 Unity: 2022.3.29f1
Error:
CommandInvokationFailure: Gradle build failed. . . . FAILURE: Build failed with an exception.
- What went wrong: Could not determine the dependencies of task ':unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl'.
Failed to install the following Android SDK packages as some licences have not been accepted. platforms;android-31 Android SDK Platform 31 build-tools;30.0.3 Android SDK Build-Tools 30.0.3 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Program Files\Unity\Hub\Editor\2022.3.29f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK . . .
Still no fix?
Still no fix?
no, unfortunately
Manually set buildtool and compile sdk works for me. If you want it to depend on Unity's settings then set some global variables in main graddle and use it in build.graddle
build.graddle
buildToolsVersion "34.0.0"
compileSdkVersion 34
defaultConfig {
minSdkVersion 25
targetSdkVersion 34
}
project.properties removes "target=android-31"
Hi everyone, is this issue fixed on version 9.4.0 that released last week?
As far as it can be seen in this commit https://github.com/googleads/googleads-mobile-unity/commit/c1c32c16dfda9a1849e30e436418c38feecdaf22
Google will probably just delete build.gradle (it doesn't really affect anything and this approach works) in some next release.
Other than that we can also try to upgrade @tin-22 answer with setting buildtools from current Unity setup
... def unityLib = project(':unityLibrary').extensions.getByName('android') ... buildToolsVersion unityLib.buildToolsVersion compileSdkVersion 34 defaultConfig { minSdkVersion 21 targetSdkVersion 34 }
Hi there, we have updated our Android Build Instructions:
https://developers.google.com/admob/unity/android
Please take a look and let me know if it helps or not.
