Android App Bundle 构建错误 : reserved file

标签 android android-bundle

新的应用发布格式 Android App Bundle 是一种改进的应用打包方式。 Android App Bundle 让您可以更轻松地以更小的应用程序提供出色的体验,从而支持当今种类繁多的 Android 设备。您无需重构代码即可开始从较小的应用程序中获益。

我在尝试构建我的应用程序 Android Bundle 时遇到此错误:

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

APK 生成工作正常

这是我的项目文件结构:

enter image description here

这是我的 AndroidManifest.xml,位于 {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>

最佳答案

在 Facebook 修复 SDK 之前,一个更简单的修复方法是将其添加到应用程序 build.gradle 的 android { } block 中的 packagingOptions:

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

我只能在构建 App Bundle 时确认这是否有效,我不知道常规 APK。

关于Android App Bundle 构建错误 : reserved file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52500757/

相关文章:

android - SharePoint - 在现有文件夹(在服务器上)内创建文件夹

java - Listview order.runOnUiThread?

java - 如何在 Activity 之间共享点击处理程序

Android:如何将枚举放入 bundle 中?

java - Android 原生 map api 还是 webview?

android - 通过 AnimationDrawable 播放动画时在运行时释放内存

Android 无法通过 AlarmManager 传递 Intent Extras

android - 为什么 Bundle in Intent 迷路了?

android - 来自 navArgs 的数据(Bundle)在系统杀死和重新创建 Activity(和 Fragment)后是否仍然存在?

java - 接收器到警报 Activity 包返回 null,即使分配了默认包值