Android Use Classes From Another Project in Eclipse


A good project architecture separates abstracted code into different projects. This short article shows how to implement this when developing for Android in Eclipse:

Note: Your code library project must be an "Android Project" for this to work

Step 1) Right click on your code library project and click "Properties"

Step 2) Click on the "Android" tab

Step 3) Click the "Is Library" checkbox then click "OK":

Step 4) Right click on the other (non-library) Android project and click "Properties"

Step 5) Click on the "Android" tab

Step 6) Click the "Add" button in the "Library" section

Step 7) Select the project that you made into a library earlier and click "OK":

Click OK again and and you will now be able to import classes from the library project and use them! :)

Facebook Twitter Google+ LinkedIn Buffer
Leave us a Comment

Connect With Us

Get our monthly newsletter with tech tips for business professionals