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"
/>
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>
.
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>
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>
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'
}
following my project structure
I want to know where exactly I am making mistake any help greatly appreciated.
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>