2012年7月13日金曜日
Android Forums Hacked: 1 Million User Credentials Stolen
2012年7月11日水曜日
GDK=Cross-Platform C++ Mobile Game Development Kit
Half of the GDK is a full C++ application shell for building a game that runs on PC, MAC, & iOS (Android coming soon). With direct support for OpenGL 2.1 & OpenGL ES 2.0 for rendering. And robust libraries for Math, Assets, Rendering, etc
The other Half is a full suite of content tools for compiling various game assets (Textures, sprites, animations, models, shaders, fonts, etc) into each platform's native format. (Which the C++ side seamlessly loads & uses)
http://code.google.com/p/gdk/
Getting android-x86 source
Introduction
This page has (hopefully) the latest information about how to build Android for x86 platforms like Eee PC. The built images runs well on a real hardware as well as virtual machines (qemu or virtual box).
Now it is very easy to compile Android for x86 platform from our git repositories. You need not to apply any patch. Just follow the below instructions.
Getting Android-x86 source code
First, follow this page to configure your build environment. Then
$ mkdir android-x86
$ cd android-x86
$ repo init -u git://git.android-x86.org/platform/manifest.git
$ repo sync
This will point the projects created or modified by android-x86 to our git server. All the other projects still point to android.git.kernel.org.
If you hope to keep syncing your tree with Android-x86 repository, just do repo sync. No need to do repo init again. However, sometimes you may see conflicts during repo sync. See the below section for how to solve this situation.
Building the image
To generate an installation and live cd developed by us, run
$ make -jX iso_img TARGET_PRODUCT=eeepc
Replace X by the number of processors you have. For example, if you have a quad core CPU, set X=4.
To generate an live USB image, run
$ make -jX usb_img TARGET_PRODUCT=eeepc
Then you will get an iso file out/target/product/eeepc/eeepc.iso, or usb image file out/target/product/eeepc/eeepc_usb.img.
If you have squashfs-tools 4.0 (older version will not work) installed in your host, the generated Android core filesystem will be compressed by squashfs. So the iso file is very small (only about 18xMB). If you hope to disable it, add USE_SQUASHFS=0 to make.
You can easily test the iso file by a virtual box or qemu. On the booting screen, select the VESA or debug mode to boot.
Of course you can burn the iso to a CD disk and test it on a real hardware. On booting it will automatically detect your hardware and load necessary modules. If you have problem with the default frame buffer driver, you may try the VESA mode (select second item on boot screen).
To test the usb image, just dump it to a USB disk
$ dd if=out/target/product/eeepc/eeepc_usb.img of=/dev/sdX
where /dev/sdX is the device name of your USB disk.
The old style Android disk installer could also be made,
$ make -jX installer_img TARGET_PRODUCT=eeepc
But it doesn't work anymore. We have no plan to fix it.
Advanced
This section describes some useful information for advanced users. You may need good linux expertise to complete it.
Install to USB disk
Now you can get a live USB disk by making usb_img target, or use the new disk installer to install Android-x86 to a USB disk. However, if you want to install by hand, this section is for you.
Here are the three steps:
- Install grub to your USB disk
- find a linux machine with the latest grub installed
- partition your USB drive with fdisk or gpartd and mark the partition as bootable
- format that partition to ext3 (recommended) or vfat.
- mount your usb drive to /mnt
- cd /mnt
- grub-install --root-directory=. --no-floppy /dev/<your usb device node name>
- cd /boot/grub
- create your menu.lst based on the next section
- Add this section to menu.lst
- Create /android directory in the USB disk, and copy the four files kernel initrd.img ramdisk.img system.sfs (or system.img if you set USE_SQUASHFS=0) to it.
title Run Android
kernel /android/kernel root=/dev/ram0 androidboot.hardware=eeepc acpi_sleep=s3_bios,s3_mode SRC=/android
initrd /android/initrd.img
title Run Android (VESA mode)
kernel /android/kernel root=/dev/ram0 androidboot.hardware=eeepc acpi_sleep=s3_bios,s3_mode vga=788 SRC=/android
initrd /android/initrd.img
title Run Android (Debug mode)
kernel /android/kernel root=/dev/ram0 androidboot.hardware=eeepc acpi_sleep=s3_bios,s3_mode vga=788 SRC=/android DEBUG=1
initrd /android/initrd.img
Then you can boot from the USB disk and enjoy Android. Note all data are saved to the ramdisk, so all will lose after power off. If you hope to save data to disk, see the next section.
Install to hard disk
Install to a hard disk is just the same as install to a USB disk. Even you do not need to create a new partition. Just copy android files into an existing partition, install grub to the hard disk (if not done yet), and modify the menu.lst.
People still ask, what if my hard disk is empty? How to install grub and copy files into it? There are several ways to do it. I provide two here:
- Boot from any rescue cd like systemrescuecd, and follow the instructions in the previous section.
- Install your favorite linux distribution, then copy android files and modify the grub menu.
Save data to USB/hard disk
We support two ways to save data to your disk.
- Create a subdirectory named data in your /android directory. The user data will be directly saved to that directory. This method only works for ext3 partition.
- Create a separate partition and save data to it. You have to add DATA=<device_name> to the boot option. For example, suppose your data partition is /dev/sda2, then add DATA=sda2 to the boot option.
How to solve conflicts
There are several reason to have conflicts during repo sync, say
- You modify your tree locally.
- The upstream changed. Since we usually keep syncing with original Android repository, sometimes we have to rebase with it. That changes the history and may cause conflicts.
In this section we assume you have conflicts due to the upstream changed. That is, you don't have local modifications. If you do, you have to solve conflicts yourself. If you follow the procedures in this section, you may lose your local modifications.
Here is an example of a conflict in the manifest:
$ repo sync
remote: Counting objects: 71, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 65 (delta 25), reused 28 (delta 9)
Unpacking objects: 100% (65/65), done.
From git://git.tarot.com.tw/android-x86/platform/manifest
d53e6c1..2de7a11 android-1.5r2 -> origin/android-1.5r2
* [new branch] android-1.5r3 -> origin/android-1.5r3
* [new branch] android-sdk-1.5_r3 -> origin/android-sdk-1.5_r3
d53e6c1..c544020 cupcake -> origin/cupcake
* [new branch] cupcake-release -> origin/cupcake-release
f4d79b1..6f7e0dd donut -> origin/donut
+ 7308d31...4a4f936 lan -> origin/lan (forced update)
+ b480a6d...d82496e local -> origin/local (forced update)
+ 11c9d96...84345fb master -> origin/master (forced update)
+ 5bcbf93...66e92cc mirror -> origin/mirror (forced update)
+ 9f3092f...665f9e8 ssh -> origin/ssh (forced update)
+ c6037be...d70927f ssh-mirror -> origin/ssh-mirror (forced update)
+ 00a823f...3ddaf66 test -> origin/test (forced update)
* [new tag] android-1.5r3 -> android-1.5r3
* [new tag] android-sdk-1.5_r3 -> android-sdk-1.5_r3
Fetching projects: 100% (128/128), done.
project .repo/manifests/
First, rewinding head to replay your work on top of it...
Applying: merge donut, change or add the projects to x86 port
error: patch failed: default.xml:3
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
CONFLICT (content): Merge conflict in default.xml
Failed to merge in the changes.
Patch failed at 0001 merge donut, change or add the projects to x86 port
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
repo sync stopped on conflicts. Since we don't have local modifications, just ignore it by git rebase --skip:
$ cd .repo/manifests
$ git rebase --skip
HEAD is now at 4a4f936 add branch for local lan
Applying: add platform/frameworks/policies/base to x86
error: patch failed: default.xml:18
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
No changes -- Patch already applied.
Applying: add branch for local lan
error: patch failed: default.xml:1
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
No changes -- Patch already applied.
If it complains about another conflict, do git rebase --skip again, until the rebase procedure completes. Usually it is enough, but if you hope to be absolute clean, you can ignore this branch and checkout a new one:
$ git checkout -b master origin/master
Replace origin with x86 if the conflict is in an x86 project.
This may not be the best approach to solve conflicts, but should be easy enough for beginners. If you have better suggestions, just tell us.
Customize kernel
If you'd like to customize the kernel for your hardware, read this article for details.
http://code.google.com/p/android-x86
Get android source code from github mirror
How to get android source code from github mirror
Get android source code using repo
Since the android.git.kernel.org is down now, so we can't get android source code from there now. But AOSP has a mirror on github, so we can try to get android source code there.
Get repo
#cd ~/your_android_dir #curl https://github.com/android/tools_repo/blob/master/repo > ~/bin/repo #chmod a+x ~/bin/repo
Init repo
#repo init --repo-url=git://github.com/android/tools_repo.git -u \ git://github.com/android/platform_manifest.git NOTE:repo-url refers to repo tool url, and -u specifies android manifests
Sync repo
#repo sync -j16
Android Project layout
- Core projects: These projects make up the foundation of the Android platform.
- External projects: The Android Open Source Project makes use of many other open source projects.
- Packages: These projects are standard Android applications and services.
Core projects
Project | Description |
---|---|
bionic | C runtime: libc, libm, libdl, dynamic linker |
bootloader/legacy | Bootloader reference code |
build | Build system |
dalvik | Dalvik virtual machine |
development | High-level development and debugging tools |
frameworks/base | Core Android app framework libraries |
frameworks/policies/base | Framework configuration policies |
hardware/libhardware | Hardware abstraction library |
hardware/ril | Radio interface layer |
kernel | Linux kernel |
prebuilt | Binaries to support Linux and Mac OS builds |
recovery | System recovery environment |
system/bluetooth | Bluetooth tools |
system/core | Minimal bootable environment |
system/extras | Low-level debugging/inspection tools |
system/wlan/ti | TI 1251 WLAN driver and tools |
External projects
Project |
aes |
apache-http |
asm |
bluez |
ccache |
clearsilver |
dbus |
dhcpcd |
dropbear |
eclipse |
elfcopy |
elfutils |
embunit |
emma |
esd |
expat |
fdlibm |
flex |
freetype |
gdata |
diflib |
googleclient |
icu4c |
iptables |
jdiff |
jfreechart |
jpeg |
kxml2 |
libffi |
libpcap |
libpng |
libxml2 |
make |
netbeans-visual |
netcat |
netperf |
neven |
opencore |
openssl |
oprofile |
ppp |
protobuf |
qemu |
safe-iop |
sdl |
skia |
sonivox |
sqlite |
srec |
strace |
swing-worker |
swt |
tagsoup |
tcpdump |
tinyxml |
toolchain |
tremor |
webkit |
wpa_supplicant |
yaffs2 |
zlib |
Packages
ApplicationsProject |
AlarmClock |
Browser |
Calculator |
Calendar |
Camera |
Contacts |
Email |
GoogleSearch |
HTML Viewer |
IM |
Launcher |
Mms |
Music |
PackageInstaller |
Phone |
Settings |
SoundRecorder |
Stk |
Sync |
Updater |
VoiceDialer |
Providers
Project |
CalendarProvider |
ContactsProvider |
DownloadProvider |
DrmProvider |
GoogleContactsProvider |
GoogleSubscribedFeedsProvider |
ImProvider |
MediaProvider |
SettingsProvider |
SubscribedFeedsProvider |
TelephonyProvider |
2012年7月10日火曜日
This document will help you set up the Eclipse IDE for Android platform development.
Enter eclipse
Basic setup
First, it's important to make sure the regular Android development system is set up.
cd /path/to/android/root
make # and wait a while, if you haven't done this
Important: You will still be using "make" to build the files you will actually run (in the emulator or on a device). You will be using Eclipse to edit files and verify that they compile, but when you want to run something you will need to make sure files are saved in Eclipse and run "make" in a shell. The Eclipse build is just for error checking.
Eclipse needs a list of directories to search for Java files. This is called the "Java Build Path" and can be set with the .classpath file. We have a sample version to start you off.
cd /path/to/android/root
cp development/ide/eclipse/.classpath .
chmod u+w .classpath # Make the copy writable
Now edit that copy of .classpath, if necessary.
Increase Eclipse's Memory Settings
The Android project is large enough that Eclipse's Java VM sometimes runs out of memory while compiling it. Avoid this problem by editing the the eclipse.ini
file. On Apple OSX the eclipse.ini
file is located at/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
Memory-related defaults (as of Eclipse 3.4)
-Xms40m
-Xmx256m
-XX:MaxPermSize=256m
Recommended settings for Android development
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
These settings set Eclipse's minimum Java heap size to 128MB, set the maximum Java heap size to 512MB, and keep the maximum permanent generation size at the default of 256MB.
Now start Eclipse:
eclipse # or you can click some clicky thing instead, if you prefer
Now create a project for Android development:
- If Eclipse asks you for a workspace location, choose the default.
- If you have a "Welcome" screen, close it to reveal the Java perspective.
- File > New > Java Project
- Pick a project name, "android" or anything you like.
- Select "Create project from existing source", enter the path to your Android root directory, and click Finish.
- Wait while it sets up the project. (You'll see a subtle progress meter in the lower right corner.)
Once the project workspace is created, Eclipse should start building. In theory, it should build with no errors and you should be set to go. If necessary, uncheck and re-check Project > Build Automatically to force a rebuild.
Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.
When you sync
Every time you repo sync, or otherwise change files outside of Eclipse (especially the .classpath), you need to refresh Eclipse's view of things:
- Window > Show View > Navigator
- In the "Navigator", right-click on the project ("android-java" or whatever you named it)
- Click Refresh in the context menu
Adding apps to the build path
The default .classpath includes the source to the core system and a sample set of apps, but might not include the particular app you may want to work on. To add an app, you must add the app's source directory. To do this inside Eclipse:
- Project > Properties
- Select "Java Build Path" from the left-hand menu.
- Choose the "Source" tab.
- Click "Add Folder...".
- Add your app's "src" directory.
- Click OK.
When you're done, the "source folder" path in the list should look like android/packages/apps/YourAppName/src. Depending on which app(s) you include, you may also need to include other src/main/java directories underandroid/dalvik/libcore. Do this if you find you cannot build with the default set.
Eclipse setup to work on developer tools
To work on Java developer tools, the principle is the same, except you specify /path/to/tool when using the option "Create project from existing source."
Once the project is created, you need to set up the Java Build Path:
- Select the project you just created.
- Project > Properties
- Select "Java Build Path" from the left-hand menu.
- Choose the "Source" tab.
- Expand the single toolname/src entry.
- Double click the "Excluded: (none)" item.
- Add to the excluded (bottom) list: "MakeFile" and "resources/".
- Close the dialog.
- Back in the "Source" tab, click "Add Folder...", and add toolname/src/resources.
- Click OK.
Eclipse setup to work on DDMS
For DDMS, you will need to make a project for
- development/tools/ddms/libs/ddmlib
- development/tools/ddms/libs/ddmuilib
- development/tools/ddms/app
Each project will need to reference the ones before it ("ddmuilib" references "ddmlib", and "app" references both of those). To do this:
- Make sure you have all 3 projects defined.
- Right click on a project, "Build Path" > "Configure Build Path..."
- Choose the "Project" tab.
- Click "Add..." and check the required projects.
Eclipse formatting
You can use a preference file in Eclipse to automatically set the formatter to the Android style guide. Import the filesandroid-formatting.xml and android.importorder, which live under development/ide/eclipse.
Debugging the emulator with Eclipse
You can also use eclipse to debug the emulator and step through code. First, start the emulator running:
cd /path/to/android/root
. build/envsetup.sh
lunch 1 # to build the emulator
make # if you didn't already do this
emulator # you should see a GUI picture of a phone
In another shell, start DDMS (the Dalvik debug manager):
cd /path/to/android/root
ddms # you should get a splufty debugging console
Now, in eclipse, you can attach to the emulator:
- Run > Open Debug Dialog...
- Right-click "Remote Java Application", select "New".
- Pick a name, "android-debug" or anything you like.
- Set the "Project" to your project ("android-java" or whatever).
- Keep the "Host" set to "localhost", but change "Port" to 8700.
- Click the "Debug" button and you should be all set.
Note that port 8700 is attached to whatever process is currently selected in the DDMS console, so you need to sure that DDMS has selected the process you want to debug.
You may need to open the Debug perspective (next to the "Java" perspective icon in the upper-right, click the small "Open Perspective" icon and select "Debug"). Once you do, you should see a list of threads; if you select one and break it (by clicking the "pause" icon), it should show the stack trace, source file, and line where execution is at. Breakpoints and whatnot should all work.
Bonus material
Replace Ctrl with the Apple key on Mac.
Ctrl-Shift-o = Organize imports
Ctrl-Shift-t = load class by name
Ctrl-Shift-r = load non-class resource by name
Ctrl-1 = quick fix
Ctrl-e = Recently viewed files
Ctrl-space = auto complete
Shift-Alt-r = refactor:rename
Shift-Alt-v = refactor:move
"Eclipse is not working correctly, what should I do?"
Make sure:
- You followed the instructions on this page precisely.
- Your Problems view doesn't show any errors.
- Your application respects the package/directory structure.
If you're still having problems, please contact one of the Android mailing lists or IRC channels.