Android Studio & EMDK For Android

Robert Galvin -
4 MIN READ
65

EMDK Projects in Android Studio

By now you have probably seen Google has released the new IDE for Android development, Android Studio. This new IDE is based on IntelliJ IDEA and thus no longer uses Eclipse. Prior to Android Studio, there were basically two options:

  • ADT Bundle
  • Ecliplse with ADT plugin for Eclipse

The current EMDK For Android supports both of these options (however you can no longer download ADT Bundle) and during the installation of EMDK For Android, one of the first prompts asks you which option you choose. Fear not, although we do not yet officially support Android Studio – you can still use it to build EMDK for Android based applications.

Using the ADT Plugin for Eclipse

During the installation of EMDK for Android, you are asked about your Android development environment:

img

If you are starting fresh,you would need to install stand alone Eclipse and the Android SDK separately and then provide the paths to each. Head over to the EMDK Setup guide for all of the not-so gory details.

img

Now you will be all set. Even though you may want to use Android Studio for development, we currently don’t have full integration, so you will need to have this Eclipse setup handy when you want to use Profile Manager features. If you just want to use the Native Barcode Java APIs, then you can practically use Android Studio stand alone.

Importing Existing EMDK Projects

Once you install Android Studio, you will want to import one of our samples to just test things out before you start/continue any full development. It is probably a good idea to just build a basic Android app using the Android Studio project wizards (they have some really cool new templates like Google Maps and Cloud Services).

  1. From Android Studio, select File\Import Project

    img

  2. Then put in the folder where the samples are locations C:\Users\Public\Symbol EMDK for Android\v3.0\Samples\ADT. You should see the list of samples:

    img

  3. Keep the rest of the default settings in the Import Wizard.

    img

    img

  4. It will then crank out a new Android Studio project and give you a nice report saying what it did. Pay attention to the new project structure (which is quite different then previous Android projects)

    img

    img

  5. Now wait a few minutes for the Gradle scripts to finish executing.

If there were no errors, then you should be able to just launch the application without any issues.

Fixing the SDK Linkage

After the Gradle script completed, you may notice an error in your project.If you open the MainActivity.java file, you will see that it does not recognize the EMDK libraries.

img

Have no fear, this can easily be fixed. Right click on the project and select Open Module Settings.

img

In the Compile Sdk Version, you will notice that the EMDK version is not listed.

img

All you need to do is manually type it in. Either enter Symbol Technologies, Inc.:EMDK 3.0 (API 19):19 or Symbol Technologies, Inc.:EMDK 3.0 (API 16):16

img

After the Gradle scripts finish executing, there should no longer be any errors and you can then run the project.

EMDKConfig.xml

If your project uses the Profile Manager features, you know there is a EMDKConfig.xml file that resided in the Assets folder. Under the new Android Studio project, you will also see it under the assets folder under the app folder:

img

Since we do not yet have the Profile Manager wizard integrated, you will not be able to generate this XML file directly from inside of Android Studio. This is where the previous Eclipse installation comes in handy. Simply generate the XML file within Eclipse and then copy it to your Android Studio project.

img

Creating New Projects

You can use the Android New Project wizard to start new development, however after creating the project you still need to follow the Fixing the SDK Linkage section above to properly enable the EMDK For Android. As of now the EMDK option does not come up in the list, you have to manually enter it (as mentioned above). You can then follow any of the previous tutorials we have – of course ignoring anything that mentioned ADT Bundle or shows the old project wizards.

img

Let me know what you think about Android Studio – would love to hear any feedback on how we can make your EMDK For Android developer experience a better one. Stay tuned for further developments on Android Studio.

profile

Robert Galvin

Please Register or Login to post a reply

Replies