Migrating Eclipse Based Projects to Android Studio
In December 2014, Google launched Android Studio, Google’s official Integrated Development Environment (IDE) based on IntelliJ and it discontinued the Android Developer Tools (ADT) plugin for Eclipse, which means it’s time to leave eclipse behind. Yes, yes, I know. Let me explain: All the projects I have published are eclipse based because Android Studio was in beta at the time I created the material.
Fortunately, there’s no need to worry, Android Studio offers a better experience for Android developers and its migration functionality does most of the work for you. Let’s assume you have:
- Downloaded the OfflineErrorHandling project that is available in https://github.com/SAP/sap_mobile_native_android
- Followed the instructions of this guide How to… Handle Synchronization Errors (Android)
- Ran the android application successfully
- Downloaded Android Studio http://developer.android.com/sdk/index.html
1. Open Android Studio and click on the option: Import project (Eclipse ADT, Gradle, etc)
2. Navigate to your eclipse workspace and select the eclipse based project and click OK
3. Select your Android Studio workspace and click Next. If the directory does not exist, another pop up window will be displayed to confirm the creation of the new folder.
4. Select all the options and let Android Studio do its work
5. When it finishes, an import-summary.txt file will open in the Android studio editor with the results of the migration.
- The MAF resources will be imported as modules.
- The armeabi files are now located under jniLibs folder in the android studio project
- A message will be displayed at the left bottom corner indicating whether the build was successfully or not
If you see errors in the bottom section, you can click on the suggested fixes to eliminate the errors.
You can run your application by clicking on the run or debug icon located in the top menu
Visit this guide How To… Setup MAF resources in Android Studio for more details about
– How to import the MAF resources from scratch
– Set up your android emulator (Appendix C)
Let’s leave eclipse behind!