Unable to install apk on Android TV box

3.3k Views Asked by At

I'm writing an app for Android TV. It runs okay on an emulator and in debug mode on an Android TV box. However, when I generate an apk using Android Studio and try to install that apk on the same box, it ends with the error below.

There is a Problem Parsing the Package

The box is running Android 7.1.2 and is certified by Android.

I tried the same on an uncertified box running Android 6.0.1 and the installation did complete, but the "open" button at the end of the installation process was disabled and the app was not among other installed apps in the menu.

First, I thought I messed something up in the android manifest, so I tried to create new TV project in Android studio and repeat the same process, but it behaved the same.

I've went through some articles related to the "There is a Problem Parsing the Package" error, but none of them mentioned Android TV and I've never encountered this issue when developing for phones/tablets.

I've also tried:

  • checking whether installation of apps from unknown sources is allowed
  • lowering the compileSdkVersion and targetSdkVersion
  • generating a signed apk

Am I missing something?

Here is the manifest of the default app created by Android Studio.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cz.okycelt.mockandroidtvproject">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />
    <uses-feature
        android:name="android.software.leanback"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.Leanback">
        <activity
            android:name=".MainActivity"
            android:banner="@drawable/app_icon_your_company"
            android:icon="@drawable/app_icon_your_company"
            android:label="@string/app_name"
            android:logo="@drawable/app_icon_your_company"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DetailsActivity" />
        <activity android:name=".PlaybackActivity" />
        <activity android:name=".BrowseErrorActivity" />
    </application>
</manifest>

Thanks for any advice.

1

There are 1 best solutions below

0
On

I found the issue. The problem was that CATEGORY_LAUNCHER missing in the main activity's intent filter in the android manifest. Apparently, CATEGORY_LEANBACK_LAUNCHER is not enough no matter that the application is Android TV only.

<category android:name="android.intent.category.LAUNCHER" />