Building Android Source apps In Eclipse

不羁岁月 提交于 2019-12-10 17:17:50

问题


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.


回答1:


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



回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/5889689/building-android-source-apps-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!