question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v7.0.0 removes permissions from the main manifest

See original GitHub issue

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

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

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:

<?xml version="1.0" encoding="utf-8"?>

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MayisGMcommented, 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.

0reactions
NVentimigliacommented, May 24, 2022

Fixed in 7.0.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove extra unwanted permissions from manifest android
I have android app, I want to check that every permissions mentioned in Manifest is required or not? Basically I want remove unwanted ......
Read more >
<activity> | Android Developers
Normally, the system clears a task, removing all activities from the stack ... see the Permissions section of the App manifest overview and ......
Read more >
A way to stop unity for adding unwanted permissions when ...
Open the created android manifest file and add permissions you dont want with property of tools:node="remove" and it will override it! no ...
Read more >
Detecting and Measuring Misconfigured Manifest in ...
ABSTRACT. The manifest file of an Android app is crucial for app security as it declares sensitive app configurations, such as access permissions....
Read more >
0.53.0 - Unity SDK Release Notes - Magic Leap 2
Fixed workflow involving permissions declaration in AndroidManifest.xml. Permissions are no longer added or removed at build time, and are fully in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found