android - 执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android 资源链接失败?
问题描述
我已经创建了具有两种产品风格的 android 应用程序,一种是生产,一种是在我有生产的动态链接时暂存我在清单中使用了以下数据代码
<data
android:host="swapitapp.page.link"
android:scheme="https"
/>
用于在 android manifest 中进行分期跟踪
<data
android:host="kuncic.page.link"
android:scheme="https"
/>
但是当我在真实设备中运行代码时出现以下错误
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\Edgar\AndroidStudioProjects\Swapit_Android\app\build\intermediates\packaged_manifests\productionRelease\AndroidManifest.xml:11: AAPT: error: unexpected element <intent-filter> found in <manifest>
.
在我的生产 AndroidManifest.xml 下面
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.mksquad.swapit">
<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:host="swapitapp.page.link"
android:scheme="https"
/>
</intent-filter>
</manifest>
below for staging manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.mksquad.swapit">
<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:host="kuncic.page.link"
android:scheme="https"
/>
</intent-filter>
</manifest>
在我的主要 AndroidManifest.xml 下面
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.mksquad.swapit">
<!-- Hide in PlayStore from devices without BLE -->
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" /> <!-- Check for available connection -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Write/Read DB and upload/download from storage -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- Bluetooth-Access -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- Needed for Android M (6.0) and above for Bluetooth usage -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- Haptic Feedback -->
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name=".SwapItApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.screenflow.splash.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.screenflow.auth.AuthActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
<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:host="swapitapp.page.link"
android:scheme="https" />
</intent-filter>
</activity>
<activity android:name="at.mksquad.swapit.ui.screenflow.auth.onboarding.OnBoardingActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.screenflow.main.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<!-- <intent-filter android:label="@string/share_intent_file_title">-->
<!-- <action android:name="android.intent.action.SEND" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <data android:mimeType="*/*" />-->
<!-- </intent-filter>-->
<!-- <intent-filter android:label="@string/share_intent_file_title">-->
<!-- <action android:name="android.intent.action.SEND_MULTIPLE" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <data android:mimeType="*/*" />-->
<!-- </intent-filter>-->
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<service android:name=".services.FbMessageService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorAccent" />
</service>
</application>
</manifest>
在我的 app.gradle 下面。我按照以下方式构建我的产品口味
productFlavors {
production {
dimension "base"
applicationId 'at.mksquad.swapit.production'
}
staging {
applicationIdSuffix ".staging"
applicationId 'at.mksquad.swapit.staging'
}
我想知道我到底在哪里犯了错误,非常感谢任何帮助。
解决方案
我通过以下方式解决了更改 android 清单文件生产和暂存的问题
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.mksquad.swapit">
<application>
<activity android:name="at.mksquad.swapit.ui.screenflow.main.MainActivity">
<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:host="swapitapp.page.link"
android:scheme="https"
/>
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.mksquad.swapit">
<application>
<activity android:name="at.mksquad.swapit.ui.screenflow.main.MainActivity">
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<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:host="kuncic.page.link"
android:scheme="https"
/>
</intent-filter>
</activity>
</application>
</manifest>
推荐阅读
- python - 数据清理(标记)失效传感器
- java - 我们可以在休眠中为多个数据库使用一个实体管理器吗?如果可以,我该如何使用 Spring MVC 来做到这一点
- robotframework - 每次执行循环时如何更改选择器?
- python - 如何让 Python 脚本写入现有工作表
- python - 从 arxiv 号获取 bibtex 条目的 shell 命令
- java - 读者必须连续阅读 2 次的 Writer/Reader
- c - C 新手;使用数组。不良输出
- node.js - 如何在对话框流中将默认日期值设置为当前日期
- mysql - 如何解决“错误无法添加外键约束”?
- python - 如何将下载的 pdf 文件存储到 Mongo DB