首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >执行com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android资源链接失败?

执行com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android资源链接失败?
EN

Stack Overflow用户
提问于 2021-09-09 17:55:18
回答 1查看 1.3K关注 0票数 1

我已经创建了android应用程序,它有两种产品风格,一个是生产版,一个是登台版,当我有用于生产的动态链接时,我在清单中使用了以下数据代码

代码语言:javascript
运行
复制
<data
            android:host="swapitapp.page.link"
            android:scheme="https"
            />

用于android清单中的暂存跟踪

代码语言:javascript
运行
复制
<data
        android:host="kuncic.page.link"
        android:scheme="https"
        />

但是当我在真实设备中运行代码时,我得到了以下错误

代码语言:javascript
运行
复制
 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下面

代码语言:javascript
运行
复制
<?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下面

代码语言:javascript
运行
复制
<?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下面。我用下面的方式构建了我的产品风格

代码语言:javascript
运行
复制
productFlavors {
        production {
            dimension "base"
            applicationId 'at.mksquad.swapit.production'
        }
        staging {
            applicationIdSuffix ".staging"
            applicationId 'at.mksquad.swapit.staging'

        }

下面是

我的项目结构

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-10 09:32:57

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

代码语言:javascript
运行
复制
 <?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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69122776

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档