Search This Blog

Saturday, March 5, 2016

Converting Android Projects from Eclipse to Android Studio

Step by step procedure how to convert Android projects from Eclipse to Android Studio.


So far all Eneter Android examples which are published on this blog are created in the Eclipse IDE. It means if you download an Android example you will find an Eclipse project for it.
However the official IDE for Android applications became Android Studio. Therefore here is a step by step guide how to convert projects from Eclipse to Android Studio.

  1. Start Android Studio.
  2. From main menu choose: File/New/Import Project...
  3. Browse to the directory with the Eclipse Android project you want to convert and press OK.
  4. The window 'Import Project from ADT (Eclipse Android)' is open. Just press Finish to continue.
  5. Android Studio will start to convert the project.
    When the converting ends and  you see an error like: 'Failed to sync Gradle project' it is probably because the Android SDK which is setup inside the project is not installed on your machine (e.g. it is too old (e.g. SDK version 7) and you do not use it for your development).
  6. To fix that issue you need to setup an SDK version you have installed:
    1. Click on the 'Project' tab-card on the left side.
    2. Choose the 'Project' view from the combo-box located in the upper-left corner.
    3. Navigate inside 'app' and open build.gradle file.
    4. Change compileSdkVersion e.g. to 23
    5. Change minSdkVersion e.g. to 10
    6. Change targetSdkVersion e.g. to 23



  7. To add the eneter library into the project you need to copy the eneter-messaging-android library into app/libs directory. Then choose: File/ProjectStructure.../app/Dependencies


  8. Click on + icon on right-top and choose File Dependency. Go into libs directory and select the eneter library and press the OK button.


  9. The library is added in the project and you should be able to compile the code.

No comments:

Post a Comment