use admob v6.0.0 when I build, it yields 3 weird permissions:
I found the reason: in manifest file in Assets\Plugins\Android\googlemobileads-unity.aar missing android:minSdkVersion so it include permission READ_EXTERNAL_STORAGE & READ_PHONE_STATE
Solution: add android:minSdkVersion to that manifest by:
googlemobileads-unity.aar to folder tempFolder<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="29" /> inside <manifest> tagjar cvf googlemobileads-unity.aar -C tempFolder/ .Just as an alternative solution, since I've had other plugins do the same is you can add these to your main manifest file and it should remove them in the final merged version.
<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" />
I was really struggling to fix this problem. Using the jar command as described above was not working and I was struggling to find the right place to put the three lines listed by mdobele. Finally, I solved the problem by adding an Android Manifest to Assets/Plugins/Android. (Sorry, it wouldn't let me upload an xml file so you will have to change the extension or copy-paste if you want to use this)
AndroidManifest.txt
manifest-merger-debug-report.txt
uses-permission#android.permission.WRITE_EXTERNAL_STORAGE
IMPLIED from /Users/xxx/Documents/AndroidProject/launcher/src/main/AndroidManifest.xml:3:1-10:12 reason: com.google.unity.ads has a targetSdkVersion < 4
uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from /Users/xxxDocuments/AndroidProject/launcher/src/main/AndroidManifest.xml:3:1-10:12 reason: com.google.unity.ads has a targetSdkVersion < 4
uses-permission#android.permission.READ_EXTERNAL_STORAGE
Why does Unity Admob add these Permissions that I never use? Please fix the bug
when will the solution be released?
This is a major problem, I just updated to 6.0.X and had this same problem, luckily I noticed Google Play warning of new permissions when I uploaded, or we would face major customer service problems (tons of emails, bad reviews, users not updating and not getting new fixes, etc)
Hello,
Why doesn't the library take the min sdk version specified in player settings?
Thanks
The library would have its own minSdkVersion requirements that should be the minimum of code it writes and any of its dependencies (e.g. Google Mobile Ads Android SDK). So it won't be your min version. v6.0.0 changed the build process and it looks like the version was unspecified. We'll aim to fix this before the next release.
- jar cvf googlemobileads-unity.aar -C tempFolder/
Where should tempFolder be? And where the new .arr file will be created?
- jar cvf googlemobileads-unity.aar -C tempFolder/
Where should tempFolder be? And where the new .arr file will be created?
The issue is fixed in latest plugin version https://github.com/googleads/googleads-mobile-unity/releases/tag/v6.1.0
- jar cvf googlemobileads-unity.aar -C tempFolder/
Where should tempFolder be? And where the new .arr file will be created?
The issue is fixed in latest plugin version https://github.com/googleads/googleads-mobile-unity/releases/tag/v6.1.0
I found my answer.
But new plugin has other issues. I submitted an issue.
Most helpful comment
Just as an alternative solution, since I've had other plugins do the same is you can add these to your main manifest file and it should remove them in the final merged version.