googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.37k stars 1.08k forks source link

Update 9.2.1 forces to install Android SDK platform 31 and Android SDK Build Tools 30.0.3 #3628

Open Remstam opened 17 hours ago

Remstam commented 17 hours ago

[REQUIRED] Step 1: Describe your environment

[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
    }
}
vinkini commented 16 hours ago

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.