Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including other Eclipse Projects in an Android application project

I have a library-only Android eclipse project (no main class, only library classes) that I want to include in my main Android Application project.

I went to the Build Path and added the library project to the "Required projects on the build path" on the Projects tab, and checked it on the "Order and Export" tab.

However, when the application is run, it emits VerifyError exception, because the class from the library project didn't happen to be packaged together in the apk.

Any solution to this?

like image 889
Randy Sugianto 'Yuku' Avatar asked Jan 12 '10 06:01

Randy Sugianto 'Yuku'


People also ask

Which Eclipse IDE is best for Android?

Eclipse Classic 3.6. 1. Eclipse IDE for Java EE Developers.

Can I use Eclipse with Android Studio?

Android Application Development can be done using Android Studio as well as Eclipse IDE. We can create android applications in Eclipse IDE using the ADT plugin.

Is Eclipse still used for Android development?

Step 5: Obtain Eclipse IDE Eclipse is the tool we'll be using to develop in. It is the most popular Android development environment and has officially supported tools from Google.


2 Answers

Android projects don't get packaged in, unfortunately. If your library project only has classes, not resources, then you can make it a normal Java project. Java projects that an Android project depends on do get packaged in.

If the library project uses Android specific classes, then when you make it a Java project you also have to add android.jar to the build path. This will be "platforms/android-1.6/android.jar" inside your SDK directory if you have the 1.6 platform installed, for example.

like image 156
Lance Nanek Avatar answered Oct 05 '22 08:10

Lance Nanek


If the library is a regular Java project, the easiest way to include it in an Android project is using a linked source folder. In the application project, go to Configure Build Path | Source | Link Source... Name the folder something like library-src and point to the src folder of the library project.

like image 40
David Chandler Avatar answered Oct 05 '22 08:10

David Chandler