Proteus Android IDE

Almost two years ago, MotoDev Studio was open sourced.  The code has sat idle in the git repositories.  MotoDev provided a lot of useful tools and additional functionality that was missing.  It provided better device integration and file exploring, a great repository of snippets, and kick ass Internationalization editor.   Since it was opened source, Google has gone a different direction with Android development, concentrating on Android Studio, and only providing bug fixes and tooling updates for the Android Development Tools based on eclipse.

I recently had an itch to resurrect the MotoDev studio plugins, and thus the Proteus Android IDE was born.  It leverages ADT 23.0.x, and includes the MotoDev basic functionality.   However it doesn’t stop there, it also is built off Eclipse Kepler, and includes, Maven and the Android Maven Connector, allow for consumption of maven artifacts.   In addition, Mylyn, Mylyn Reviews, the Gerrit Connector, EGit, and Github connectors are included.   Also included is the Gradle Tooling plugins from SpringSource.

The addition of these plugins on top of ADT, help form the basis going forward for hopefully a first class IDE for Android development based on eclipse.

The goal currently is to provide a community supported project where additional Android tooling can be done that extends and addresses the issues around ADT.   Eclipse developers and particularly corporate consumers should be able to leverage and use the tools they know and love.

Right now Proteus is a person project, and one that has a lot of other things going on.   So it needs help to survive and thrive.   This is where the eclipse community comes into play.   The project is hosted on GitHub, it is licensed under an Eclipse Development License 1.0, with MotoDev residing under Apache 2.0.     You can get the current code, from the link below:

https://github.com/kingargyle/proteus

Binaries and more information about the project can be found at the wiki:

https://github.com/kingargyle/proteus/wiki/Proteus-IDE

The project will need a community to form around it to survive and thrive long term.  It will be what the eclipse android community makes it.  So feel free to Fork the code, play around with it, and send in pull requests.   Maybe together we can make the Android IDE that we deserve.

 

Posted in eclipse, mylyn, maven, android | 3 Comments

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.

 

Posted in android, googletv, maven, open source, serenity | Leave a comment

Serenity for Android now on Amazon Fire TV

serenity-bonsai-logo

Version 1.7.3 should now be available in the Amazon App store and be available for the Amazon Fire TV.   A newer version has been submitted that should bring it up to speed with the Google Play version in a few days.   For best playback experience,   it is recommended to use an external video player.  If you can, side load MX Player for the best integrated experience.

6a0148c71fb71b970c0153901475c3970b-pi

Serenity uses the same code base without changes as the versions that run on Google TV, Tablets, Android HDMI sticks, OUYA, and Android TV devices.

What do you get over the official Plex application:

  • Multiple user selectable views, select between Grid and Detail views for TV Shows and Movies
  • Video Queue and Continuous Playback support.
  • User configurable preferences for Default catagories on TV Shows and Movies.  Select the starting category for browsing from the preferences.
  • Integrated support of Plex meta data for supported External Players (i.e MX Player).  Plex metadata will update current playback position and watched/unwatched status.
  • Optional Overscan adjuster.  Accessible through the User Preferences.
  • Quick Navigation with the Remote Control or attached Blue Tooth Keyboard.
  • Optimized for Remote and Game Controller use.

Serenity does not support all the Plex functionality.  If your video library requires transcoding and you can’t use an external player that supports playback of your content, then the offical Plex client may be a better choice.   But if you can Direct Play all your content or are experiencing issues with the official client, you may want to give Serenity a spin.  It may fit your browsing needs.

 

Posted in android, googletv, open source, plex media server, serenity | Leave a comment

Update the AndroidManifest Version Number automatically

Recently I needed to automate the update of the versionName element in the AndroidManifest.xml file. This needed to be timed stamped and updated with the correct version number when a build was run. We use maven as part of the build, a few plugins come in handy. We want to use POM’s version number so that tools like the maven-release-plugin or maven versions plugin can be used. When these are run the new version number should reflect in the built APKs.

The following magic added to the build portion of the pom handles this.

<plugins>
   <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.8</version>
      <executions>
         <execution>
            <id>parse-version</id>
               <goals>
                  <goal>parse-version</goal>
               </goals>
               <phase>validate</phase>
          </execution>
       </executions>
    </plugin>
    <plugin>
       <groupId>com.google.code.maven-replacer-plugin</groupId>
       <artifactId>maven-replacer-plugin</artifactId>
       <version>1.4.1</version>
       <executions>
         <execution>
            <id>replace-version</id>
            <phase>validate</phase>
            <goals>
               <goal>replace</goal>
            </goals>
         </execution>
       </executions>
       <configuration>
          <file>AndroidManifest.xml</file>
          <replacements>
              <replacement>
                 <token>0.0.0</token>									<value>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${maven.build.timestamp}</value>
              </replacement>
          </replacements>
          <quiet>false</quiet>
       </configuration>
   </plugin>
</plugins>

You can add this as part of a profile, and only enable it when you are building say on Jenkins or when you are doing a release. Your AndroidManifest.xml should have the versionName value set to 0.0.0, and when the build runs with the profile enabled it’ll replace this with the pom’s version and also add a time stamp.

Posted in android, maven, release engineering | Leave a comment

Jersey + Jetty = less hair

This is mainly for future me when I run into this problem again. I needed to use Jersey 2.x and had setup an embedded Jetty server for some integration testing. One portion needed to get the parameters from a POST request and needed to pass on the HttpServletRequest. However, injecting the HttpServletRequest always returned empty values for the params. Jersey was consuming them before hand. In order to get around this, I had to implement a subclass of HttpServletRequestWrapper, here is the underlying code:

public class JerseyMultiValueMapWrapper extends HttpServletRequestWrapper {

   MultivaluedMap<String, String> oAuth2Params;
   public JerseyMultiValueMapWrapper(HttpServletRequest request) {
     super(request);
   }
	
   public JerseyMultiValueMapWrapper(MultivaluedMap<String, String> params, HttpServletRequest request) {
     super(request);
     oAuth2Params = params;
   }
	
   @Override
   public String getParameter(String name) {
     return oAuth2Params.getFirst(name);
   }
}

You can then pass this along to the API that expects the HttpServletRequest. I needed this mainly when working with the Apache Oltu api, as it only accepted HttpServletRequests and kept failing validation due to missing parameters.

Hopefully this helps some others.

Posted in java, open source | Leave a comment

Findbugs and Android

Recently I needed to add FindBugs to a android-maven build. This itself is easy enough.

<profile>
   <id>findbugs</id>
   <build>
     <plugins>
       <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>2.5.2</version>
          <executions>
             <execution>
               <phase>package</phase>
               <goals>
		<goal>findbugs</goal>
               </goals>
               <configuration>
                  <findbugsXmlOutput>true</findbugsXmlOutput>
                  <failOnError>false</failOnError>
                  <excludeFilterFile>${basedir}/findbugs-filter.xml</excludeFilterFile>
               </configuration>
            </execution>
          </executions>
       </plugin>
     </plugins>
   </build>
</profile>

The above will analyse the classes as part of the package proecess. This is fine, however, the generated R.java file typically produces class names that don’t follow the java naming standard. Since there is nothing that can be done about this, we need to exclude this extraneous information from the generated xml analysis. Fortunately findbugs offers a filter mechanism.

The above excludeFilterFile entry refers to a findBugs filter that contains the necessary information to exclude the R.java file. Typically this is generated in your top level package. For example to
exclude the Class naming error from the report you can have your findbugs-filter.xml look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
   <Match>
     <Package name="us.nineworlds.serenity"/>
     <Bug pattern="NM_CLASS_NAMING_CONVENTION" />
   </Match>
</FindBugsFilter>

This will exclude the Class Naming Convention check from the java package specified. More information can be found in filtering section of the findbugs manual.

Posted in android, clean code, craftsmanship, maven | Leave a comment

YouTube GData API and Android

If you want to use the YouTube API v2 to search for content on YouTube with an Android device, the recommended way is the use the gdata-http-client java package. However, this requires that you parse the XML returned yourself, and navigate it. The reason is that out of the box the YouTube API v2 java library doesn’t work on Android. This is due to a requirement on the javax.mail package which isn’t available officially on Android.

However, thanks to the wonders of the internet, you can get a package of javax.mail and activation which have been compiled to work on Android. The javamail-android project contains jars have been compiled to work with Android and it’s DEXer.

For those using Maven, I have added these to my maven repo. Add the following repository to your pom to make it available:

<repository>
  <id>serenity-thirdparty-repo</id>
  <url>http://kingargyle.github.com/repo</url>
  <layout>default</layout>
   <releases>
      <enabled>true</enabled>
      <updatePolicy>always</updatePolicy>
      <checksumPolicy>warn</checksumPolicy>
   </releases>
</repository>

Then for dependencies for the YouTubeAPI you can add the following to your pom for your app.

      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-youtube</artifactId>
         <version>2.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-youtube-meta</artifactId>
         <version>2.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-core</artifactId>
         <version>1.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-media</artifactId>
         <version>1.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-client</artifactId>
         <version>1.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.gdata</groupId>
         <artifactId>gdata-client-meta</artifactId>
         <version>1.0</version>
      </dependency>
      <dependency>
         <groupId>com.google.guava</groupId>
         <artifactId>guava</artifactId>
         <version>11.0.2</version>
      </dependency>
      <dependency>
        <groupId>com.google.gdata</groupId>
        <artifactId>mail</artifactId>
        <version>1.0</version>
      </dependency>      
      <dependency>
        <groupId>com.google.gdata</groupId>
        <artifactId>activation</artifactId>
        <version>1.0</version>
      </dependency>

You may want to run ProGuard to help cut down the size of the guava library brought in by the app, as it alone adds about 1.1mb to the size of your application.

With the above added you can use the YouTube GData v2 API to search YouTube for videos and deal with java objects.

Posted in android, build, java, maven, serenity | Leave a comment