执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade > 时发生故障Android 资源链接失败? [英] A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android resource linking failed?

查看:75
本文介绍了执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade > 时发生故障Android 资源链接失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了具有两种产品风格的 android 应用,一种是生产,一种是当我有生产的动态链接时,我在清单中使用了以下数据代码

I have create android app which has two product flavors one is production one is staging when I have dynamic links for production I have used following data code in manifest

<data
            android:host="swapitapp.page.link"
            android:scheme="https"
            />

用于在 android manifest 中进行跟踪

for staging following in android manifest

<data
        android:host="kuncic.page.link"
        android:scheme="https"
        />

但是当我在真实设备上运行代码时出现以下错误

but when I run code in real device I am getting following errors

 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 下方

below my Production 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 下方

below my main 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 下面.我按照以下方式构建我的产品口味

below my app.gradle. where I have structure my product flavors following way

productFlavors {
        production {
            dimension "base"
            applicationId 'at.mksquad.swapit.production'
        }
        staging {
            applicationIdSuffix ".staging"
            applicationId 'at.mksquad.swapit.staging'

        }

遵循 我的项目结构

我想知道我到底在哪里犯了错误,非常感谢任何帮助.

I want to know where exactly I am making mistake any help greatly appreciated.

推荐答案

我通过以下方式解决了更改 android manifest 文件生产和暂存的问题

I solved my problem changing android manifest files production and staging in following way

 <?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>

这篇关于执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade > 时发生故障Android 资源链接失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆