GFlam
GFlam

Reputation: 1109

Building Android Source apps In Eclipse

I downloaded the source to spareparts here

https://android.googlesource.com/platform/development/+/gingerbread-release/apps/SpareParts

It includes Android.mk, AndroidManifest.xml, Notice, res and src folders.

My question is how can I compile this source code in Eclipse? I see there is a make file (Android.mk) which I'm guessing I need to use but I can't figure out what to do to get this thing imported into Eclipse without having 500+ errors.

Upvotes: 4

Views: 5079

Answers (3)

uvesten
uvesten

Reputation: 3365

This article seems to have the answer. According to it you would need to download all of the source just to build one of the apps, though.

Upvotes: 2

Aleadam
Aleadam

Reputation: 40401

Brute force always works :)

  • Create a new android project in Eclipse named SpareParts
  • Use the explorer to replace both the src/ and res/ folders inside workspace/SpareParts with the ones downloaded form git
  • Click with the right button on the SpareParts entry in the project tree in Eclipse -> Refresh
  • enjoy

I looked into the files and it does not seem that it uses any external library. If you try to build it by itself, you will still have problems due to these three classes that are not in android.jar:

import android.app.ActivityManagerNative; //cannot be resolved
import android.os.ServiceManager; //cannot be resolved
import android.view.IWindowManager; //cannot be resolved

Upvotes: 1

Egor
Egor

Reputation: 40228

In Eclipse try File->Import... and General->Existing Projects into Workspace, add the project folder and then try to compile it. Hope it helps.

Upvotes: 0

Related Questions