Question about building Android 1.5 source for emulator - G1 Android Development

I just had a quick question, haven't been able to find any answers elsewhere. Figured I'd ask it here. I Was wondering if it's possible to build the Android source so that the resulting Android Emulator disk images contains all of the apps of a normal Android 1.5 system?
I've tried building the source twice now but, the disk images are just the normal emulator disk images (missing most of the default apps & some of the graphical improvements of the 1.5 update). I feel like it must be some sort of setting in the makefile to say what platform to build for.
Any help would be greatly appreciated.

Do I need to follow the instructions listed here? Will this enable the build process to build the emulator disk images so that they mimic the G1 completely (including all default Android apps, etc) ?
http://source.android.com/documentation/building-for-dream

Those apps you are referring to are closed source and no matter how you build it, they won't show up in the emulator. You could possibly install them after the fact, but that is truely hit or miss.

Related

Recompile and overwrite applications in system/app

As an experiment I am trying to rebuild some standard android applications and replace them in system/app on the G1. I have been through all the steps to get the source code and build for the dream platform and have built the various .apk files of interest (e.g. AlarmClock.apk, Browser.apk etc)
To put the files on the device I delete the old .apk and .odex files and copy my newly built .apk file on to the device. However when I try to run the application it crashes with the following message.
The application Alarm Clock (process com.android.alarmclock) has stopped unexpectedly. Please try again.
I know that replacing the applications like this is possible, because the AutoRotating Browser build works fine when copies over in this manner.
I'm using JF1.31 (RC8)
My initial reaction was that I was not signing the applications properly but having read some posts I think the default built .apk should have the right key already in it.
Another theory I have is that perhaps the applications from the head of the source tree are not compatible with the RC8 (or RC30) Android OS releases. Can anyone tell me how to get the source tree which corresponds to this baseline, I've done some reading around but cannot figure it out. I presume I need to do a repo init -u git://android.git.kernel.org/platofrm/manifest.git -b BASELINE but I can't figure out what BASELINE should be.
Many thanks in advance for any help you can give me!!!
There are some branches in android sources:
master
cupcake
release-1.0
Apps from the first two will not run on default G1, you need to reinstall a whole system. I think by default, following google docs you'll get master. So you need to download a release-1.0 sources.
I may be wrong, but that is what I'm see from my experience.
Thanks for that, I'll get the 1.0 branch downloaded and have a go with that.
Cheers for your help!
I was also trying to recompile some of the built-in apps, specifically the browser, but I can't even get it to build. I get a bunch of import errors, stating that it can't find some of the android libraries, such as android.net.http.AndroidHttpClient, android.os.AsyncTask, etc. I've got the android.jar from the SDK in my build path, and it finds some of them, such as android.webkit.URLUtil.
Can anyone shed some light on what I need to do to get it to see the missing libraries? Thanks.
UndeadCretin said:
Thanks for that, I'll get the 1.0 branch downloaded and have a go with that.
Cheers for your help!
Click to expand...
Click to collapse
There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.
Are you resigning the .apk files? Cuz you have to do that for them to work correctly.
Koush said:
There are around a dozen build breaks in release-1.0... all of them are due to missing header #includes in various .c and .h files. So, when it doesn't work, don't give up. Fix the breaks and everything will build properly.
Click to expand...
Click to collapse
Yep I fixed these problems but I have now hit upon the following problem:
(unknown): error 17: Field android.hardware.SensorManager.LIGHT_NO_MOON has changed value from 0.0010f to 0.001f
******************************
You have tried to change the API from what has been previously released in
an SDK. Please fix the errors listed above.
******************************
I've been in and modified SensorManager back to 0.0010f and that let me build get further but I hit the same error again later in the build.
Given that release-1.0 should be a stable branch is it normal to get all these build issues?
Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Just tried building the AlarmClock application and running on the G1 and it works fine. Thanks everyone for your help!
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Can you write, what did you fix?
^ Agreed, let us know which files need modifying and what needs doing, i've been trying to get my release-1.0 build root working too!
Alternatively, UndeadCretin, could you build the firmware (release-1.0) with a modified framework-res i can send you?
Ok, I managed to compile it without any editing of xml.
Just added stdlib, string, vector headers to dozen of cpp/h.
worry said:
>Managed to fix the java issue by modifying public_api.xml. Then hit several more C++ problems which I fixed and finally I can build the lot!
Can you write, what did you fix?
Click to expand...
Click to collapse
To fix the java issue, I modified frameworks/base/core/java/android/hardware/SensorManager to change the LIGHT_NO_MOON value to 0.0010f (from 0.001f) and in out/target/common/obj/PACKAGING I modified the <field name="LIGHT_NO_MOON" to have value-"0.0010f">
After this there were several other c++ files which were missing relevant includes. I'm afraid I didn't keep a note of these so cannot provide much detail but mostly they were missing one of the following
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
I think one file needed the following include
#include <string>
and there were a couple of other files that needed other includes. The best way to find these is to google for the function name that isn't building and you should be able to find the appropriate include (that's how I did it).
Hope that helps a bit!
were you able to repo sync after adding the local_manifest.xml?
ximonx said:
were you able to repo sync after adding the local_manifest.xml?
Click to expand...
Click to collapse
I did try that previously but it didn't work. I don't think the relevant files for the dream build are available in the release-1.0 branch. This wasn't a problem for me since I'm only interested in building the applications which work fine with the generic build.
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?
Phlogiston said:
I would like to do the same for the mms application. Could you give me the steps or a link how to do it? I mean do I need the whole sources from android platform to do it? How can I just compile one application?
Click to expand...
Click to collapse
I downloaded the whole Android source (the release-1.0 branch) and compiled the lot. It may be possible to just build the individual application but I do not know how. It is not vital to build for the dream platform if you only care about the applications since they will work fine with the generic build.
So the basic steps to start are:
Get yourself a Linux or Mac OS platform (I use Ubuntu running in VMWare on my XP box).
Follow the instructions here: http://source.android.com/download but when you come to repo init add the flag -b release-1.0
Fix various build problems
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?
ximonx said:
When recompiling individual apps to replace system apps is there a way of just building a single application or does the entire thing need making?
Click to expand...
Click to collapse
My experience is that you have to do the whole thing if you are building from source. There is one way I know of to get around this, which is to use baksmali and smali.
Just to be clear, making the entire thing = build from source root?
ximonx said:
Just to be clear, making the entire thing = build from source root?
Click to expand...
Click to collapse
If you are asking me--yes, that's what I mean. Make sure to build for dream-open as the target (it's generic by default).

Adding APIs to Android: modifying SDK, system and kernel?

I'm sorry if this is a really basic question or has been answered elsewhere before, but I couldn't find how to do it after a lot of searching on this forum, so here goes:
I'm developing an app that requires advanced networking functionality, and am trying to modify the wifi driver on Android to expose a custom API to my Android app (in Eclipse/Java) that isn't part of the stock Android SDK. I've managed to successfully compile a new kernel with my driver modifications (on Nexus S/Jellybean) so that part's good, but I also need to add the API to the Android OS and SDK, recompile and flash them, and then get my Eclipse/Java project to compile and link against the custom version of Android I've built.
Does anyone know what the best way to add a custom API to Android is, or could they point me to a step by step guide if this has been answered before? In particular, once I've built a new version of the Android kernel, the system and the SDK and flashed the custom ROM that supports this API to my phone, how do I get Eclipse/Android apps that I write to link against my new API/modified SDK?
Thanks a lot!

List of jargon.

I keep getting bombarded with so many jargon on this forum. So this list is to help out the many noobs like me.
List of jargon:-
(Also to help other noobs like me, I am also including the ones whose meanings I have figured out. Pls feel free to correct me. I am a noob after all. )
[I have bolded the ones for which I need info.]
MOD - Short for MODified. This is a commonly used jargon in gaming and mobile.
CM - Cyanogen Mod - A modified version of Android with unique features.
AOSP - Android Open Source Project - The official Android which is the base for CM and is also used by the phone manufacturers.
FXP - Free Xperia Project (http://freexperiaproject.com) - A version of CM, specially maintained for Xperia phones.
CWM - Clock Work Mod - Used to provide Recovery mode.
Kernel - The lower part of the Android OS. Actually this is not part of Android. On stock phones, this provided by the phone manufacturers. This allows manufacturers to go wild about their hardware and use their proprietary hardware technologies w/o disclosing that to Android. Android needs a predetermined set of APIs from the kernel to work.
ROM - Traditionally ROM stood for Read Only Memory, which were only flashable once. However, in current context it is not like that. This is the Android OS we know. This interacts with the hardware via the kernel. All app and user managements is carried out by this.
GAPPS - Google APPS. Namely - Google Play, Gmail, etc.
MDPI - Phones with Medium DPI resolution. DPI is Dots Per Inch. So this denotes the screen pixel density. Note, screen density and screen size are independent concepts. MDPI is about 160dpi. This is the average.
JB - Jelly Bean - The latest version of Android. Android 4.1 and 4.2 (latest) are both versions of Jelly Bean.
ICS - Ice Cream Sandwich - Version 4.0.x of Android.
GB - Ginger Bread - Version 2.3.x of Android.
FC - Force Close - When an app hangs and closed forcibly or it crashes.
Kang - Means stolen. However, since open source codes cannot be "stolen", so in this context it becomes - unofficial.
AOKP - Android Open Kang Project - Similar to CM, this is another port of Android with many crazy features like you can customize the LED color based on notifications of your choosing.
Dalvik - Android has a built-in Java Virtual Machine which it uses to run the Apps. (The apps are coded in Java.) Dalvik is an Android port of SUN (now Oracle) JVM. This was the thing for which Oracle sued Google.
APK - This is the extension of the Android apps. This is a package (actually a zip file) with all the app related files.
Odex - A pre-optimized file in the app's APK which the Dalvik VM can directly run. See SO and this thread.
Deodex - APK packages have classes.dex file, which has all the Java classes needed to run the app. This is a deodex file. First time when the app is launched, Dalvik VM needs to parse this file and create an optimized version of it, which it runs. That file is kept inside Dalvik Cache. See SO and this thread.
Dalvik Cache - Contains the optimized versions of the deodex files. More info at - this thread.
Additional jargon lists and references:-
[Guide]What is HSPL, MAGLDR, cLK, and CWM, and how to install them.?
ASOP should be AOSP, the Android Open Source Project
You can add AOKP, the Android Open Kang Project
...You can add Kang, which basically means Unofficial
FC is Force Close, when an Android app crashes
Dalvik Cache, see this thread
You can add Odex and Deodex, see this thread.
post-mortem said:
ASOP should be AOSP, the Android Open Source Project
You can add AOKP, the Android Open Kang Project
...You can add Kang, which basically means Unofficial
FC is Force Close, when an Android app crashes
Dalvik Cache, see this thread
You can add Odex and Deodex, see this thread.
Click to expand...
Click to collapse
I got the full form of ASOP from Google but can you explain it? I am confused since I thought Android was already open source, so what exactly is Android Open Source Project?
Also pls provide a short description about Android Open Kang Project. Android with "Unicorn Bytes", doesn't quite explain it.
He's just saying switch the letters around you have ASOP and it should be AOSP
Kang in programming terms means stolen code, however as you cant really steal something that is open source it more refers to a 'fork' of the AOSP, i.e they copied the code
The Android open source project, is the completely open source and free to use version of Android, i.e without Google apps. It is run by Google however there are many people that contribute to it and it features open software stacks for a range of devices (nexus devices etc).
It is designed to be a base from which manufacturers, developers or anyone really can modify and build on, this is where the likes of CM take their base from/ But manufacturers (Sony, HTC etc) will also use this.
In other words 'Android' is the operating system, the 'Android open source project' is a completely open source and free version of Android. (Much like Chromium is the open source version of Chrome)
This could potentially be a very useful sticky. Other words which could be added are root, radio, bootloader, recovery, partition etc. Most of those can be found in the HD2 terms guide in my sig (I think).

Android Internal API with Android Studio

Hi everyone!
I'm looking for help how to get Android Studio working with Androids Internal API.
There is a very good tutorial HERE that shows how to set everything up in Eclipse,
but since Eclipse is now deprecated and Google will be dropping support for ADT plugin
the logical move is to set everything up with Android Studio.
The things I did are pulling the boot.oat file from stock Nexus 5X, and use the standard procedure to get framework.jar and framework-classes2.jar.
After getting the internal packages out of the framework, I modified the android.jar file by adding all the missing packages.
The problem is even though all references, classes, interfaces and resources are there and the code doesn't give errors or warnings
that classes could not be found, the build still fails with messages like these:
Code:
error: package com.android.internal.R does not exist
com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
...
cannot find symbol
mLocales = LocalePicker.constructAdapter(this);
...
Basicly, anything related to the internal API gives an error only when compiling.
My next idea is to build all the internal classes as a library and add it to the project where I need it,
but I wanted to ask does anyone else have any better ideas or suggestions?
I've done my googling but I haven't found anything recent and related to AS, only Eclipse.

How one can debug apk without sources or open source app apk without full recompile?

Hi,
Is it possible to debug apk without sources or open source app apk without full recompile?
I needed and tried to debug (Android Stock) Email app , found its sources from AOSP code storage,
opened it in Android Studio, was forced to compile it back - I mean Android Studio opened something available Debug" button, codes were shown only .smali, then I attached original source codes...
But I didn't able to debug it, since it stopped with some mysterious error, something like: "certificates is not coincide with required one" or similar...
So, what I can to to do that?? It is very difficult to compile app newly since it needs build system to be adopted for building as separate android app.
Thanks
Was this wrong place to ask? I can not write into "Developent" Thread on this Forum yet.

Categories

Resources