To program mobile applications Android an appropriate IDE is needed, like Android Studio or eclipse with suitable plug-in. When setting up the eclipse environment you may face some problems. Here are the most common mistakes and solutions when setting up the eclipse environment for Android.
Your current eclipse should have JDT. JDT provides “a set of plug-ins that add the capabilities of a full-featured Java IDE to the Eclipse platform. The JDT plugins provide APIs so that they can themselves be further extended by other tool builders”. To check if you already have installed JDT click Help->About Eclipse -> Installation Details. You will find the Eclipse Java Development Tools in Features.
Android SDK Manger
The SDK Manger has many different SDKs that can be installed. But which SDKs shall be installed? If you want to test your application on diverse emulators/ devices the more you install the better. I would recommend checking which version will cover almost all Android devices on the current market.
What you certainly need to install is the Android Support Library. Otherwise your projects will be built with errors. After the installation you have to import the library in your workspace. You can look up the required steps here .
Set the right version in the AndroidManifest.xml
The AndroidManifest.xml is crucial for your application as it contains all information to run the app. Check the versions defined in this file. For example android:minSdkVersion=”8″ or android:targetSdkVersion=”21. Remember never to set the supported versions higher than your actually installed SDK. Otherwise compilation will fail.
If you want to maintain your app along with the Android releases adapt the version in the AndroidManifest.xml with each new release. Don’t forget to test your application.
Errormessage “the project target (android 2.2) was not properly loaded”
Do run eclipse as an administrator.
Errormessage “AppCompat v7 r21 returning error in values.xml”
When I received this error the latest version was Android 5.0. So the according API has to be installed. In order to compile the application with AppCompat it also has to compile against API 21 . In your Android SDK Manager do install the SDK Version 21 AND the buildToolsVersion (21.0.1). Use always the highest Version because it is the latest build tool. Always check if you have installed the right SDKs for the set version.
Errormessage “Parsing data for Android-21 failed.Unsupported major.minor version 51.0”
First check if you really have installed the SDK version (in the Android SDK Manager) mentioned in this error. Otherwise this problem occurs because the Android version and the installed java version are incompatible. You may have to update java. With Android version 51.0 at least java 7 is needed. The number indicates with which java JRE it is compatible [3,4]:
J2SE 8 = 52, J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45
Errormessage “Unsupported major.minor version”
You may have changed the used java version in eclipse (Window->Preferences->Java->Installed JRE). Now check the version which is used when starting eclipse (in the CommandLine with java -version). The java version you use to start eclipse and the version you use within eclipse differ. You have to start and run eclipse with the same java version. When installing a new java version, bear in mind:
- For a 32-bit eclipse you have to install a java 32-bit version. Don’t mix 64 bit and 32 bit versions
- For multiple java versions on your computer, make sure to set your PATH variable with the right version. It is best to write the version at the beginning of the PATH .
- Check your registry, if it doesn’t contain the different java versions the command java-version won’t find any.
Clean and restart
Whenever all these tips don’t help, start eclipse as administrator, try to clean your projects (Project–> Clean…) or just restart eclipse. Sometimes it is the only thing needed to make everything work.