Get Your Development Environment Ready for Android L (Developer Preview)

android-LAndroid L Developer Preview is an early release of the upcoming Android platform. This post shows how to get your development environment ready, how to create a simple app & how to use Material Design theme.

 

( 1 ) Install Latest Eclipse ADT

I recommend to install a fresh Eclipse from Android Developer site. If you like to use your existing Eclipse, make sure that you have ADT plugin version 23.0.0 or later. You can check your ADT version from Help >> Install Software… >> already installed?

  • Go to Android Developer site
  • Download Eclipse ADT
  • Unzip the downloaded file into you favorite directory

( 2 ) Run Android SDK Manger Update

  1. Run Android SDK Manager.
  2. Under Tools section, select the latest Android SDK Tools, Platform-tools, and Build-tools.
  3. Select everything under the Android L Developer Preview section
  4. Click Install packages…
  5. Accept the Licensing Agreement for all of the packages and click Install.

android-sdk-manger-L-preview

 

( 3 ) Configuring AVD or Emulator (on Windows)

  1. Star Android Virtual Device manger (AVD)
  2. Click Create…
  3. Use the following settings:
    • AVD Name: pick a name e.g. L-Preview
    • Device: Either Nexus 5 or Nexus 7
    • Target: Android L (Preview) – API Level L
    • CPU: Intel Atom (x86)
  4. Run the Emulator (it may take long time the first time you run it)

android-avd-L-preview

 

( 4 ) Create Your First Android L Project

  • Create a new Project use the following settings:
    • Application Name: Android L
    • Project Name: android-L-preview
    • Package Name: com.hmkcode.android.L
    • Minimum SDK: L Preview
    • Target SDK: L Preview
  • Click Next
  • When you reach Activity window Select Empty Activity
  • Click Finish
  • If the MainActivity is not created under src folder, right click on the project and select New >> Other >> under Android select Android Activity >> Empty Activity

 

( 5 ) Use The new Material Theme

  • res/values/styles.xml
<resources>
   <style name="AppTheme" parent="android:Theme.Material.Light">
  </style>
</resources>
    • AndroidManifest.xml

Notice: minSdkVersion=”L”

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hmkcode.android.L"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="L"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

( 6 ) Deploy & Run

android-L-app-run

 Source Code @ GitHub

Leave a Reply