0

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.

okycelt
  • 111
  • 1
  • 6
  • Try to follow the steps in this [SO post](https://stackoverflow.com/questions/1492401/parse-error-there-is-a-problem-parsing-the-package-while-installing-android). Also you can check from [this blog](https://www.problogbooster.com/2015/09/fix-there-was-a-problem-parsing-the-package-solve-parse-error.html) if you are missing some steps, this is just an additional reference in case you need a step by step guide. Additionally, you may need to see this [SO post](https://stackoverflow.com/questions/5492311/there-is-a-problem-parsing-the-package). – MαπμQμαπkγVπ.0 Mar 15 '18 at 08:45
  • Thanks for the suggestions, but I've already went through all three of these yesterday. – okycelt Mar 15 '18 at 09:34
  • In https://www.problogbooster.com/2015/09/fix-there-was-a-problem-parsing-the-package-solve-parse-error.html they talked about four possible reasons. I believe 1, and 4, are out, I've tried multiple .apk files installed from usb flash drive, google drive and the internal memory. I think 3, is related to installation of apps from unknown sources, which I believe is also out. As for 2, I don't see any reason why the application shouldn't be suitable for my hardware or os version. – okycelt Mar 15 '18 at 09:43

1 Answers1

1

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" />

okycelt
  • 111
  • 1
  • 6