Building Android TV sample application

AndroidTVsampleApp-2015-07-01-150913

Let’s look how Android TV app works by building this sample application.

At the time of writing (2015/6/25), I faced a compile error for building default sample application  for Android TV. I wrote another posts that how to resolve these issues, which are the temporary counter measure until the errors will be fixed by AOSP.

Environment

Android studio version: 1.2.2 Build 141.1980579
SDK version: API level 21 & 22.

Procedure

1. Launch Android studio → Start a new Android Studio project

2. “New project” display, fill in below.

Application name: use your own preference (Ex. HelloAndroidTV)
Company Domain: use your own preference (Ex. yourname.com)

and go “Next”.

3. “Target Android Devices” display

Uncheck “Phone and Tablet” (It is checked by Default.)
Check “TV” with Minimum SDK API level 21.

and go “Next”.

4. “Add an activity to TV”,

Select “Android TV Activity”

and go “Next”

5. “Customize the Activity” display,

Name of the Activities are already filled by default as

  • Activity Name: Main Activity
  • Main Layout Name: activity_main
  • Main Fragment: MainFragment
  • Title: MainAcitivity Title
  • Details Activity: DetailsActivity
  • Details Layout Name: activity_details
  • Details Fragment: VideoDetailsFragment

you can just press “finish” without changing names for this time.

After that, Android studio will auto generate codes, after generation click “Run app” button (shown as green triangle button) to build the source code.

If you get compile error…

Please refer following for fixing bugs.

  1. Plugin with id ‘android-sdk-manager’ not found
  2. String types not allowed (at ‘slideEdge’ with value ‘end’)
  3. no suitable constructor found for HeaderItem(int,String,)

Build it and try it!

If successful, you can launch an application shown at the top of this page. You can also try to go around inside the apps, see content details, and watch trailer!

Sponsored Links

2 responses

    • Hi Tian,

      Yes I’m using SONY BRAVIA TV.
      But I also have Nexus player, sometimes using it as well (evaluating Android M etc.).

Leave a Reply

Your email address will not be published.