Manifest in obj should not contain WRITE_EXTERNAL_STORAGE if it is not declared in the project.
This permission should not be included in the manifest in APK either (after running Archive for Publishing).
Xamarin.Android adds WRITE_EXTERNAL_STORAGE to permissions even though it is not selected in the manifest.
Xamarin.Android should not add WRITE_EXTERNAL_STORAGE permission if not checked in the manifest.
=== Visual Studio Community 2019 for Mac ===
Version 8.7.8 (build 4)
Installation UUID: 0be7cb3e-0171-43b8-99c3-b7ba76999bd0
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000093
=== Mono Framework MDK ===
Runtime:
Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
Package version: 612000093
=== Roslyn (Language Service) ===
3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32
=== NuGet ===
Version: 5.7.0.6702
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.402/Sdks
SDK Versions:
3.1.402
3.1.200
3.1.102
3.1.101
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.8
3.1.2
3.1.1
2.1.22
2.1.16
2.1.15
=== Xamarin.Profiler ===
Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 11.0.2.0 (Visual Studio Community)
Commit: xamarin-android/d16-7/025fde9
Android SDK: /Users/wkulik/Library/Android/sdk
Supported Android versions:
None installed
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 29.0.3
Build Information:
Mono: 83105ba
Java.Interop: xamarin/java.interop/d16-7@1f3388a
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/wkulik/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-09-16 05:12:24 UTC
=== Android Device Manager ===
Version: 16.7.0.24
Hash: bb090a3
Branch: remotes/origin/d16-7
Build date: 2020-09-16 05:12:46 UTC
=== Xamarin Designer ===
Version: 16.7.0.495
Hash: 03d50a221
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-08-28 13:12:52 UTC
=== Apple Developer Tools ===
Xcode 12.1 (17222)
Build 12A7403
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 14.0.0.0 (Visual Studio Community)
Hash: 7ec3751a1
Branch: xcode12
Build date: 2020-09-16 11:33:15-0400
=== Build Information ===
Release ID: 807080004
Git revision: 9ea7bef96d65cdc3f4288014a799026ccb1993bc
Build date: 2020-09-16 17:22:54-04
Build branch: release-8.7
Xamarin extensions: 9ea7bef96d65cdc3f4288014a799026ccb1993bc
=== Operating System ===
Mac OS X 10.15.7
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Mon Aug 31 22:12:52 PDT 2020
root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Thanks for the feedback which will be handled by our gurus.
Check your AssmblyInfo.cs file in the project. Mine has
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
These are default permissions which we determined most users might need, you can just edit this file and removes the ones you don't need or remove them completely and just use the manifest.
@jonpryor we should talk about wether we need these in the AssemblyInfo.cs file anymore or not...
Thank you! Yes, that was the problem with the clean project. And now I've found what was the problem in my project. Package Xamarin.Forms.Maps adds this permission.
Btw. I think it should not be by default in AssemblyInfo.cs. Why there are any permissions and not just in the Manifest file?
I reported issue: https://github.com/xamarin/Xamarin.Forms/issues/12680
@wojciech-kulik The Internet and external Storage permissions are there to support our Debugging system. In order to use the debugger you need network access. To use fast deployment you needed external storage. I seem to remember they used to be in an #if DEBUG code block, but that does not seem to be the case anymore. I suspect we had customers who wanted to debug release configurations.
The reason they were in the AssemblyInfo.cs and not in the manifest was so that users would not remove them by accident I guess. if they did debugging would no longer work and it would not be obvious as to why. So its a bit of a tricky problem, at some point we do need both of those permissions if the user wants to debug.
That said the external storage requirement probably won't be needed since we re-wrote the fast deployment system recently via https://github.com/xamarin/xamarin-android/pull/4690.
Traditionally we have tried to guide users away from having to manually edit the manifest and towards attributes instead ([Activity], [UsesPermission], etc.). It generally makes it easier for newer developers and people not familiar with Android development, although it is probably a bit more confusing for people who are already familiar with how native Android development works.
This also made it easier for libraries that require certain permissions to specify them automatically, since manifest merging didn't exist when we originally did it this way.
Most helpful comment
@wojciech-kulik The Internet and external Storage permissions are there to support our Debugging system. In order to use the debugger you need network access. To use fast deployment you needed external storage. I seem to remember they used to be in an
#if DEBUGcode block, but that does not seem to be the case anymore. I suspect we had customers who wanted to debug release configurations.The reason they were in the AssemblyInfo.cs and not in the manifest was so that users would not remove them by accident I guess. if they did debugging would no longer work and it would not be obvious as to why. So its a bit of a tricky problem, at some point we do need both of those permissions if the user wants to debug.
That said the external storage requirement probably won't be needed since we re-wrote the fast deployment system recently via https://github.com/xamarin/xamarin-android/pull/4690.