Skip to content
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

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

Open
Remstam opened this issue Oct 11, 2024 · 19 comments

Comments

@Remstam
Copy link

Remstam commented Oct 11, 2024

[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
    }
}

@vinkini
Copy link
Collaborator

vinkini commented Oct 11, 2024

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.

@AntonPetrov83
Copy link

Does not specifying specific targetSdkVersion of 31 break compatibility with Unity player settings? What if the project targets 34 or 35?

@Krou
Copy link

Krou commented Oct 29, 2024

the same issue with Google Mobile Ads Unity plugin version 9.3.0 and Unity 2021.3.45f1

@vinkini
Copy link
Collaborator

vinkini commented Oct 29, 2024

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.

@Krou
Copy link

Krou commented Oct 30, 2024

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

@MayisGM
Copy link

MayisGM commented Oct 31, 2024

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?

@MayisGM
Copy link

MayisGM commented Oct 31, 2024

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

@MayisGM
Copy link

MayisGM commented Nov 3, 2024

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.

@Krou
Copy link

Krou commented Nov 4, 2024

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.

@MayisGM
Copy link

MayisGM commented Nov 4, 2024

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?

@N1Joke
Copy link

N1Joke commented Nov 4, 2024

Hey, i solved it. Just install what they require in your unity version. Also tested on 2022.3.41
image

@MayisGM
Copy link

MayisGM commented Nov 4, 2024

Hey, i solved it. Just install what they require in your unity version. Also tryed on 2022.3.41 image

Hey, thank you for response. I saw this solution in forums, but is this safe for other plugins?

@N1Joke
Copy link

N1Joke commented Nov 4, 2024

Hey, i solved it. Just install what they require in your unity version. Also tryed on 2022.3.41 image

Hey, thank you for response. I saw this solution in forums, but is this safe for other plugins?

still in testing process

@dcosmin-97
Copy link

dcosmin-97 commented Nov 5, 2024

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.

@whynullname
Copy link

@dcosmin-97 It worked! Thank you!!

@MuhammadWaqasOfficial
Copy link

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
.
.
.

@Hetagkaty
Copy link

Still no fix?

@Krou
Copy link

Krou commented Nov 13, 2024

Still no fix?

no, unfortunately

@tin-22
Copy link

tin-22 commented Nov 14, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests