Maven, Android L, Android TV, and a bit less hair.

While working on upgrading my app for Android TV.  I ran into some build issues.  There are problems with the way the Android L support libaries define their depenencies in the m2repository that comes with the SDK.   In general they are not specifying the Type for the depenency to be AAR, but leaving it without a type.   So for tools like Maven, this means it defaults to looking for a JAR.  However the m2repository doesn’t contain these artifacts as jars, only as AARs.   So builds fail, cats and dogs start sleeping together, and forces of Xul start to take over the world.

To get around this issue, one needs to setup some exclusions and then include the necessary AARs as dependencies.  Its ugly, it shouldn’t have to be done, but it works.   So with out further ado, if you need to use the v17-leanback support library here is the magic sauce.

      <dependency>
         <groupId>com.android.support</groupId>
         <artifactId>support-v4</artifactId>
         <version>21.0.0-rc1</version>
         <type>aar</type>
      </dependency>
       <dependency>
           <groupId>com.android.support</groupId>
           <artifactId>support-annotations</artifactId>
           <version>21.0.0-rc1</version>
       </dependency>
      <dependency>
         <groupId>com.android.support</groupId>
         <artifactId>leanback-v17</artifactId>
         <version>21.0.0-rc1</version>
         <type>aar</type>
          <exclusions>
              <exclusion>
                      <groupId>com.android.support</groupId>
                      <artifactId>recyclerview-v7</artifactId>
              </exclusion>
              <exclusion>
                  <groupId>com.android.support</groupId>
                  <artifactId>support-v4</artifactId>
              </exclusion>
          </exclusions>
      </dependency>
      <dependency>
         <groupId>com.android.support</groupId>
         <artifactId>recyclerview-v7</artifactId>
         <version>21.0.0-rc1</version>
         <type>aar</type>
          <exclusions>
              <exclusion>
                  <groupId>com.android.support</groupId>
                  <artifactId>support-v4</artifactId>
              </exclusion>
          </exclusions>
      </dependency>

Hopefully if you are using the android-maven-plugin to build your app, this brings a bit of sanity to building your Android L enabled apps.

 

Advertisements
This entry was posted in android, googletv, maven, open source, serenity. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s