Android Source Not Compilable?
So I've been looking at code from vario开发者_如何学编程us parts of the Android git, but when I try to load and compile many of them (camera, media player, etc) they reference classes and parts of the SDK that just aren't available even with my SDK version updated to 2.2. (for example the bitmap config option inNativeAlloc)
Is there a reason that these are not in the SDK given out to developers?
If you want to compile applications from the android open source project (ASOP), like the browser, camera, media player etc. You have to build on a Linux or Mac. You cannot compile the source on Windows.
See Get Android Source Code on info for building the source and the OS requirements requirements
Is there a reason that these are not in the SDK given out to developers?
There are several possibilities, depending on what "these" are.
I am under the impression that most of the cases are that they simply have not gotten around to it yet. By "gotten around to it yet", I mean they haven't finalized the classes and method signatures they want to stick with for all time. The core Android team tries to minimize the amount of API breakage between releases, and generally succeeds (breakage tends to be more changed behaviors than changes in method signatures). Getting buy-in from all stakeholders for a given hunk of code takes a fair bit of effort. There is a ton of code in Android, some of which probably could go in the SDK, but only so much time gets allocated to that chore, compared to advancing Android capabilities.
In some cases, the answer is security -- that beyond not having a stable API, they do not know how they want to secure it yet, so they make it be available solely to firmware developers.
In a few cases, the answer may be performance -- they have their required use cases tuned appropriately, but there are others that outside developers might try that have not been optimized.
I am sure there are other possible reasons as well.
精彩评论