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.
- Start Android Studio.
- From main menu choose: File/New/Import Project...
- Browse to the directory with the Eclipse Android project you want to convert and press OK.
- The window 'Import Project from ADT (Eclipse Android)' is open. Just press Finish to continue.
- 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).
- To fix that issue you need to setup an SDK version you have installed:
- Click on the 'Project' tab-card on the left side.
- Choose the 'Project' view from the combo-box located in the upper-left corner.
- Navigate inside 'app' and open build.gradle file.
- Change compileSdkVersion e.g. to 23
- Change minSdkVersion e.g. to 10
- Change targetSdkVersion e.g. to 23
- 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
- Click on + icon on right-top and choose File Dependency. Go into libs directory and select the eneter library and press the OK button.
- The library is added in the project and you should be able to compile the code.