[Android] How to overwrite permissions

Hi!
I’ve started to have some weird permissions in my AndroidManifest.xml file.
Some of them come with admob extension, others, no idea.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

I really want just
<uses-permission android:name="android.permission.INTERNET" />

Replacing AndroidManifest.xml with my own template doesn’t help, I still get those permissions.
Does anyone know how to fix that?
Thank you!

I can’t speak from personal experience with this, but I did note this tutorial the other day.
OpenFL Template Basics: Overriding AndroidManifest.xml

Yep, this is the very first thing, I’ve tried, didn’t help.

In this file, you can find out where this permission came from.

(build_path)/android/bin/app/build/outputs/logs/manifest-merger-release-report.txt

Yes, thank you, I’ve actually reviewed this file again, and found some more details.
As I’ve already mentioned, some permissions come from admob, but now I see the reason:

uses-permission#android.permission.WRITE_EXTERNAL_STORAGE
IMPLIED from …\bin\android\bin\app\src\main\AndroidManifest.xml:2:1-29:12 reason: com.admobex has a targetSdkVersion < 4
uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from …\bin\android\bin\app\src\main\AndroidManifest.xml:2:1-29:12 reason: com.admobex has a targetSdkVersion < 4
uses-permission#android.permission.READ_EXTERNAL_STORAGE
IMPLIED from …\bin\android\bin\app\src\main\AndroidManifest.xml:2:1-29:12 reason: com.admobex requested WRITE_EXTERNAL_STORAGE
uses-permission#android.permission.ACCESS_NETWORK_STATE
ADDED from [com.google.android.gms:play-services-ads-lite:19.5.0] …gradle\caches\transforms-2\files-2.1\31c131232a6e4629187bfdd4c8fff82f\play-services-ads-lite-19.5.0\AndroidManifest.xml:24:5-79

Still, I don’t know where exactly this permission comes from:

uses-permission#android.permission.RECEIVE_BOOT_COMPLETED
ADDED from [androidx.work:work-runtime:2.1.0] …gradle\caches\transforms-2\files-2.1\8b34ffa1d2135fbc82c7193fb1dd165d\work-runtime-2.1.0\AndroidManifest.xml:27:5-81

Look here https://github.com/haxelime/lime/issues/1435 maybe it helps.

Well it is the opposite for me, I had to put <uses-sdk android:minSdkVersion="4" /> to extension-admob (I put 9 not 4) to get rid of some permissions.
And I don’t have any gradle build errors.

Once I had an issue with android build caused by <uses-sdk android:minSdkVersion="4" /> got to generated project.

When I tried to figure out where it came from I had found that it is extension-api located in lime repo.

Maybe increasing version in given file would affect permissions somehow.
On the other hand, dependencies like com.google.android.gms may affect permission itself, so did you check how behaves raw android studio project with such dependencies like those in gradle files of project generated by lime?

Looks like @pozirk uses Gradle 2.1.0, above error appears with higher gradle versions

Nope, my Gradle version is 5.6.3.
When I build an empty project though, I don’t have this odd permission, need to check further where it comes from:

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

UPDATE: It comes from admob extension as well. :frowning:
And androidx.work is something that comes with the latest admob 19.5.0.

UPDATE2: So I’ve manually put admob version to 19.4.0 and RECEIVE_BOOT_COMPLETED is gone.
Let’s consider it fixed.