Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App Bundle build error: reserved file

The new app publishing format, the Android App Bundle, is an improved way to package your app. The Android App Bundle lets you more easily deliver a great experience in a smaller app size, allowing for the huge variety of Android devices available today. You don’t need to refactor your code to start benefiting from a smaller app.

I'm getting this error trying to build my app Android Bundle:

File 'root/AndroidManifest.xml' uses reserved file or directory name 'AndroidManifest.xml'.

APK generation works fine.

This is my project file structure:

enter image description here

And this is my AndroidManifest.xml, located under {ProjectName}/app/src/main:

<?xml version="1.0" encoding="utf-8"?>
            <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                package="com.XXXX.XXXX"
                android:installLocation="auto">

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

                <!-- These permissions are strongly recommended and will result in higher performance -->
                <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
                <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
                <uses-permission android:name="android.permission.VIBRATE" />

                <application
                    android:name="com.app.webview.Application"
                    android:allowBackup="true"
                    android:icon="@mipmap/ic_launcher"
                    android:label="@string/app_name"
                    android:supportsRtl="true"
                    android:theme="@style/AppTheme"
                    android:hardwareAccelerated="true">
                    <activity
                        android:name="com.app.webview.MainActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:label="@string/app_name"
                        android:launchMode="singleTask">
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN" />

                            <category android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>

                        <!-- Universal APP Link -->
                        <intent-filter>
                            <action android:name="android.intent.action.VIEW" />

                            <category android:name="android.intent.category.DEFAULT" />
                            <category android:name="android.intent.category.BROWSABLE" />

                            <data android:scheme="http" />
                            <data android:scheme="https" />
                            <data android:host="@string/app_host" />
                        </intent-filter>
                    </activity>

                    <!-- Push -->
                    <!-- Services that handles incoming message -->
                    <service
                        android:name="com.app.webview.Providers.FCM.FcmListenerService">
                        <intent-filter>
                            <action android:name="com.google.firebase.MESSAGING_EVENT" />
                        </intent-filter>
                    </service>

                    <!-- Called if InstanceID token is updated -->
                    <!-- This may occur if the security of the previous token had been compromised -->
                    <service
                        android:name="com.app.webview.Providers.FCM.FcmInstanceIDListenerService"
                        android:exported="true">
                        <intent-filter>
                            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
                        </intent-filter>
                    </service>

                    <!-- Facebook Config -->
                    <meta-data
                        android:name="com.facebook.sdk.ApplicationId"
                        android:value="@string/id_facebook" />

                    <activity
                        android:name="com.facebook.FacebookActivity"
                        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                        android:label="@string/app_name"
                        android:theme="@android:style/Theme.Translucent.NoTitleBar"
                        tools:replace="android:theme" />

                    <provider
                        android:name="com.facebook.FacebookContentProvider"
                        android:authorities="@string/facebook_provider"
                        android:exported="true"
                        tools:replace="android:authorities" />

                    <!-- Fabric -->
                    <meta-data
                        android:name="io.fabric.ApiKey"
                        android:value="XXXX" />
                </application>  
            </manifest>
like image 925
Javier Marín Avatar asked Sep 25 '18 14:09

Javier Marín


1 Answers

A much simpler fix until Facebook fixes the SDK would be to add this to the packagingOptions in the android { } block of your app's build.gradle:

android {
   packagingOptions {
      exclude 'AndroidManifest.xml' //This fixes a bug in FAN 5.0.1
   }
}

I can only confirm this works when building an App Bundle, I do not know about a regular APK.

like image 77
Jason Sznol Avatar answered Oct 12 '22 11:10

Jason Sznol