I have single activity, Mainactivity.java
. And I want to run it on both, phones and TVs. I have created 2 separate layout
files for both devices.
And I have changed my Manifest file according to this answer.
AndroidManifest.xml
<?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.example.currencyrates"
android:theme="@style/Theme.AppCompat"
tools:ignore="MissingLeanbackLauncher">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.software.leanback"
android:required="false" />
<uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Leanback"
android:banner="@drawable/lb_search_orb">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:label="@string/app_name"
android:theme="@style/Theme.Leanback"
android:exported="true"
tools:ignore="DuplicateActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
But the app crashes with below errors:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:processDebugMainManifest'. Manifest merger failed with multiple errors, see logs
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugMainManifest'.