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:
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.
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).
From Android Studio, select
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:
Keep the rest of the default settings in the Import Wizard.
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)
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.
Have no fear, this can easily be fixed. Right click on the project and select
Open Module Settings.
Compile Sdk Version, you will notice that the EMDK version is not listed.
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
After the Gradle scripts finish executing, there should no longer be any errors and you can then run the project.
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
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.
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.
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.
ft-sm-as.jpg 11.1 K