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

v7.0.0 removes permissions from the main manifest #2001

Closed
MayisGM opened this issue Mar 29, 2022 · 10 comments
Closed

v7.0.0 removes permissions from the main manifest #2001

MayisGM opened this issue Mar 29, 2022 · 10 comments
Assignees
Labels
P1 Priority issue.

Comments

@MayisGM
Copy link

MayisGM commented Mar 29, 2022

[REQUIRED] Step 1: Describe your environment

  • Unity version: 2020.3.23
  • Google Mobile Ads Unity plugin version: 7.0.0
  • Platform: Android (iOS, Android, Unity Editor)
  • Platform OS version: Android 9 (eg iOS 10, Android 9)
  • Any specific devices issue occurs on: No specific devices
  • Mediation ad networks used, and their versions: All mediations has the latest versions

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Add this permission to the main AndroidManifest.xml file for example:

After building the project which includes Google Mobile Ads SDK version 7.0.0 the permission will be removed from the main manifest. The reason of this happening is AndroidManifest.xml file inside googlemobileads-unity.aar, which looks like this:

Relevant Code:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.unity.ads" >

    <uses-permission
        android:name="android.permission.READ_PHONE_STATE"
        tools:node="remove" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        tools:node="remove" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        tools:node="remove" />
    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

Please let us know how to temporarily solve this issue, or please release fixed version as soon as possible.

@NVentimiglia NVentimiglia self-assigned this Mar 31, 2022
@NVentimiglia NVentimiglia added the P1 Priority issue. label Mar 31, 2022
@PokerDawg
Copy link

I think I found a temporary solution to this.
.aar files are basically .zip files, so open Assets/Plugins/Android/googlemobileads-unity.aar with whatever archive software you have (I'm using 7zip) and extract its contents. Edit the AndroidManifest.xml file by deleting the lines that remove permissions. It should look like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary metadata
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.unity.ads" >

    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

Now take all the files and zip them back up. Rename the archive to googlemobileads-unity.aar (no .zip extension) and replace it in your Unity project. I'm not sure it's necessary, but I restarted the editor and force resolved with EDM.
We're using a plugin to save pictures to the user's gallery, and it's working again after I modified the .aar. From the limited time we've had with this solution, we didn't find any problems with the ads or anything else. Regardless, we're hoping for a fix to be released soon.

@MayisGM
Copy link
Author

MayisGM commented Apr 1, 2022

I think I found a temporary solution to this. .aar files are basically .zip files, so open Assets/Plugins/Android/googlemobileads-unity.aar with whatever archive software you have (I'm using 7zip) and extract its contents. Edit the AndroidManifest.xml file by deleting the lines that remove permissions. It should look like this:

<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary metadata
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.unity.ads" >

    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

Now take all the files and zip them back up. Rename the archive to googlemobileads-unity.aar (no .zip extension) and replace it in your Unity project. I'm not sure it's necessary, but I restarted the editor and force resolved with EDM. We're using a plugin to save pictures to the user's gallery, and it's working again after I modified the .aar. From the limited time we've had with this solution, we didn't find any problems with the ads or anything else. Regardless, we're hoping for a fix to be released soon.

Thank you for sharing your temporary solution. I tried described solution too, and that worked, but as I was not sure this solution will not harm other components of Google Mobile Ads Unity SDK I decided to use SDK version 6.1.2, because it doesn't have this issue. Let's wait for the official fix of this issue.

@stickylabdev
Copy link

i wondering where to put AD_ID permission

@MayisGM
Copy link
Author

MayisGM commented Apr 3, 2022

i wondering where to put AD_ID permission

As I know you just need to add this to permissions section in main AndroidManifest.xml:

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

@stickylabdev
Copy link

stickylabdev commented Apr 3, 2022 via email

@NVentimiglia
Copy link
Member

Thank you for the report.

This will be fixed in the next release.

@Nyankoo
Copy link

Nyankoo commented Apr 15, 2022

@NVentimiglia Any ETA for the next release?

@ericleich
Copy link
Member

@stickylabdev For adding the AD_ID permission, it should be added automatically by the play-services-ads dependency if using version 20.4.0 or higher per the Android release notes. Unity plugin v7.0.0 looks to be distributed with 20.6.0, meaning you shouldn't have to add the permission manually.

@stickylabdev
Copy link

@stickylabdev For adding the AD_ID permission, it should be added automatically by the play-services-ads dependency if using version 20.4.0 or higher per the Android release notes. Unity plugin v7.0.0 looks to be distributed with 20.6.0, meaning you shouldn't have to add the permission manually.

The problem is this #2000 (comment)

@NVentimiglia
Copy link
Member

Fixed in 7.0.1.

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

No branches or pull requests

6 participants