Porting AOSP to specific hardware device - android

UPDATE: Based on this Here is following question: Create specific device tree for AOSP
I followed this: https://source.android.com/source/building.html and set up the environment and downloaded the latest AOSP. Now I wnat to flash it on my specific device, let's say Galaxy S2.
In the "Configuring USB Access: 51-android.rules", how it should look? Because in above official tutorial each entry looks like:
//adb protocol for device X
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="user"
//fastboot protocol for device X
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="user"
But in many places I found this:
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
Of course adding user to plugdev group is obvious, but still: In Google`s way there is separate entries for adb & fastboot, and the mode is different...
What would be the ultimate test to see if this step works?
Suppose I modify the correct lines of code & config files for my specific device like stated here: Android device configuration for AOSP. Which means I have a directory with full AOSP files. In the stage of $ lunch aosp_arm-eng what parameters should be for specific hardware device?
Now suppose I have in my output directory built & compiled AOSP files. How should I flash it on my device? It's not very clear from Google`s above tutorial. I prefer to get just a single zip file in order to flash it via CWM recovery etc.
Is there a way to test the result before flashing it on hardware device (To reduce the chances for brick...)?
Thanks,

The adb rules are to enable adb to work over USB. If you can connect to your device over ADB then the adb rules worked. You may have to enable ADB in the device's Developer Settings.
After you have synced AOSP you can build for your device. You can choose your device in the lunch menu. Run the build/setenv.sh script. Then run lunch. It will have a list of specific devices you can choose from. You can add to that list by syncing new device trees into the tree.
By default it will build system.imgs that you flash through fastboot. If you are building AOSP, make otapackage will make a flashable zip.
The build will make an emulator image that you can test by running emulator. That will give you a general idea of if your build works, but will not give you the full story with regards to your specific device. For instance, the emulator build might run but if you forgot to add the correct proprietary files the build might not boot on your specific device. But you are very unlikely to hard brick your device by flashing a system.img.

Related

Android did not recognise my android 7inch tablet 3.2 honeyComb

My Android eclipse did not recognizing my 7 inch android tablet. its installing and showing usb icon on window but when i tried to run my application the device is not showing on eclipse.
You probably have to update your adb_usb.ini to include the USB ID of your device and/or install a driver if you're on Windows.
I had to this when I started developing for Kindle Fire.
Here's a page of instructions for Archos: http://www.archos.com/support/support_tech/updates_adb.html?country=us&lang=en You can probably find a similar page for your manufacturer.
After that, you need to stop adb and restart it and then you should be able to see your device.
Check out this THIS LINK.
I think you are facing problems in setting up your system for development, so take a look at step 3 on above link.
a. Log in as root and create this file: /etc/udev/rules.d/51-android.rules.
Use this format to add each vendor to the file:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
b.Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
And if you are on ubuntu, THIS LINK will help you.
Good luck!

Eclipse wont recognize my android tablet when I try to test my app?

Recently I bought a new android tablet (a no-name Chinese tablet), and I'd like to test an application I'm developing on it.
However, when I try to run it through Eclipse, it won't recognize my tablet (the debugging mode is enabled on the tablet). When I have the select device dialog I see
Serial Number : ???????????
AVD Name : N/A
Target : unknown
Debug :
State : ??
I'm running Linux Mint. What should I do?
On Linux, you have to add an udev rule for your tablet. For instance:
#cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
you can use lsusb in order to retrive the vendor id
Bus 002 Device 016: ID 0502:3325 Acer, Inc.
For Linux you need to setup UDEV to support the manufacture's identity, or you need to restart adb using sudo.
To do it correctly, do this:
lsusb
and look for your tablet:
Bus 002 Device 008: ID 04e8:6860 Samsung Electronics Co., Ltd
Note the ID.
Then go to /etc/udev/rules.d and create a new file called androiddevelopment.rules in that file put this:
SUBSYSTEM=="usb", ATTRS{idVendor}=="xxxx", OWNER="yyyy", GROUP="zzzz"
Where xxxx is the first part of the ID (04e8 in my example), yyyy owner is your username and zzzz is your group.
Then restart udev:
sudo service udev restart
That should allow Linux to automatically allow your user to connect to that device.
Problem: How to get Eclipse to recognize my 7" RCA tablet:
This problem frustrated me for two days. I have a generic RCA 7" tablet that I bought at a Black Friday sale at Walmart. I was trying to use it with the Android SDK and eclipse, but my computer would not recognize the tablet as anything more than a storage device. I found several clues that led me in the right direction, but nothing seemed to work; finally found my answer here:
http://pychildren.blogspot.se/2012/12/getting-android-adb-working-with-pipo.html
(Before you start, if you are as much of a newbie as I am, go to this site first to find out something about terminal commands -
community.linuxmint.com/tutorial/view/100
I was working with Linux Mint 15. I had also installed the Eclipse and Android sdk bundle.
No matter what I did, Eclipse would not recognize my tablet. Finally I got the problem resolved. I really just had to three things:
First I had to go to my home folder
Then to the .android folder
Then add the following line to the bottom of the "adb.usb.ini" file:
0x2207
and save the file. I was able to do this from the GUI interface.
Second, I had to open a terminal and navigate to the file system folder
Then to the etc folder
Then to the udev folder
Then to the rules.d folder
I had to create a file called
"51-adroid.rules" that contained only two lines:
SUBSYSTEM=="usb", SYSFS{idVendor}=="2207", MODE=="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0x2207", MODE=="0666"
(I probably needed only the last line, but several sources had not included the "0x" so I included it both ways.
Then, still in the terminal, I ran the following command from my home folder after the ? (just enter cd to return to the home folder)
sudo Development(the name of the folder in which I installed Eclipse and the sdk, yours will be different)/sdk/platform-tools/adb kill-server
Then I had to run the following command from the home folder
sudo Development(the name of the folder in which I installed Eclipse and the sdk)/sdk/platform-tools/adb start-server
I also had to make sure that debugging was enabled on my tablet.
I also turned off wifi on my tablet - no one but my last source had mentioned this, but I think that it may have helped.
Then, when I typed in "adb devices", my tablet was recognized. When I started Eclipse and started the Hello program, it displayed beautifully on my tablet. I just don't understand why my wife was not impressed.

Android - How to load HelloWorld app onto my Phone?

I made an Android Hello world app and I'm trying to load it onto my HTC Incredible. I believe it has 2.2 (how do I confirm that?)
Anyway, Eclipse gives me this message and then brings up the window in the screenshot below.
Automatic Target Mode: Unable to
detect device compatibility. Please
select a target device.
I'm on Ubuntu 64bit if that matters. I did turn on USB debugging on the phone. I told the phone to connect as a disk drive.
Any ideas how to get my app onto the phone?
Update: Do I need to perform these steps since I'm on Ubuntu? I doesn't mention what to do for Ubuntu 8.10 though.
Ok, it turns out I did have to follow all the instructions from this page. (The sudo stuff mentioned in other answers above didn't help.)
Here are the exact commands I ran for Ubuntu 8.10
You need to run the adb server in superuser mode (i.e. sudo adb start-server).
Try what EboMike said, run sudu adb start-server.
To answer your question "how do I confirm my phone is V2.2?" Press your phone's menu key, then settings, about phone, software information. The Android version is the number you're looking for. This shouldn't be important though for your hello world example.
Also, it's not important that you have the phone connect as a disk drive; this causes the SD card to be dismounted. It will actually cause problems if you run or debug an application that tries to access the SD card. You can just select charge only and use ADB/Eclipse's DDMS perspective to move files to and from the phone.
Here's an update answer in case anyone finds this thread from Google.
http://dimitar.me/how-to-connect-your-android-phone-to-ubuntu-to-do-developmenttestinginstallations-or-tethering/
The easiest way to this: Go to www.dropbox.com and sign up for a free account. Copy your .apk file from your project's /bin directory to your Dropbox. Download and install the free Dropbox app from the Android Market. Navigate to your .apk file on the Dropbox app and click it to download and install on your phone.
These are the steps I took on Arch Linux to resolve the same problem:
As mentioned in some of the other replies you will need a udev rule for the device. In this example I am using an HTC Desire.
(for HTC you'll need to use "0bb4")
Get the correct Vendor and Product IDs
run lsusb with the handset plugged in and you should see something like Bus 001 Device 004: ID 0bb4:0c87 High Tech Computer Corp. Desire (debug)
'0bb4' is the Vender ID: HTC
'0c87' is the Product ID
Make a udev rule using the values you've just retrieved
Now make a udev rule as root using:
$ sudo vim /etc/udev/rules.d/51-android.rules
Add the following (this is for HTC Desire - edit accordingly):
## Rule for an HTC Desire Android Phone
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87", MODE="0666", GROUP="users", NAME="HTC Desire"
GROUP defines which Unix group owns the device node.
At this point I rebooted and found that my handset was detected. Supposedly you can reload udev rules using the following but if this doesn't work try rebooting.
$ sudo udevadm control --reload-rules
in eclipse: go to Run menu -> Run configuration. Right click on android application on the right side and click new. Fill the corresponding details like project name under the android tab. Then under the target tab. Select launch on all compatible devices and then select active devices from the drop down list. Save the configuration and run it by either clicking run on the run button on the bottom right side of the window or close the window and run again
Cheers !

Using HTC wildfire for android development

I would like to know whether is it possible to use my HTC wildfire (some links would be nice) for android development instead of the emulator.
I have tried to find the information by Google, but so far no useful results.
If I get more information, I'll update here.
[When I used wildfire with eclipse, I got this.]
Thank you very much.
From your screenshot, it looks like you do not have the permissions set properly to access the USB device.
Either try to run the adb service as root:
$ sudo adb kill-server; sudo adb start-server
OR, the more permanent solution is to set up udev rules for USB device permissions. See the instructions in step 3 of the android Developing on a Device page.
Log in as root and create this file: /etc/udev/rules.d/51-android.rules. The udev system checks this file for special cases when devices are detected.
Edit the file to read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
This sets permission bits on the dev node to world read and writeable for the special case where the USB vendor ID is equal to 0bb4.
Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
... gives world read permission to these android rules which is needed to let the udev daemon process this new rule.
Sure, all you need is to install the USB driver and follow the directions from here.
The USB driver is included in the HTC Sync software, which you can get here.
Go to htc website
http://www.htc.com/europe/SupportViewNews.aspx?dl_id=982&news_id=769
and download the driver
and just connect the htc phone to the pc and run the application from eclipse.
No configuration needed. It directly runs on the phone instead of emulator.
Cheers!
The only other thing I can think of is how you've set your phone to connect via usb-to-computer... And that might just solve my own similar problems... I'm using "HTC Sync" as my connection style, when I haven't even tried the others.
Lets find out, shall we?
Nope. Connection type didn't matter at all. "Charge Only", "disk drive", "usb tethering", it didn't change my behavior at all (I can launch apps, but logcat shows nothing from my app, and my breakpoints are ignored).
Sounds like it's time for a new question.
If device still not detected (???), after updating /etc/udev/rules.d/51-android.rules as suggested earlier, also unplug and re-plug the usb cable into the device.

How to debug on a real device (using Eclipse/ADT)

I'm trying to figure out how to debug applications directly on my phone (HTC Desire).
I've installed the USB driver that came with the phone and the phone is listed when using "adb devices".
How do I configure eclipse/ADT to launch on the phone instead of launching the emulator/virtual device?
Note: This answer is a heavily modified version of this guide that used to exist at developer.android.com. Portions of it are quoted verbatim from the original text without attribution for the specific parts that are quoted.
With an Android-powered device, you can develop and debug your Android applications just as you would on the emulator.
1. Declare your application as "debuggable" in AndroidManifest.xml.
<application
android:debuggable="true"
... >
...
</application>
2. On your handset, navigate to Settings > Security and check Unknown sources
3. Go to Settings > Developer Options and check USB debugging
Note that if Developer Options is invisible you will need to navigate to Settings > About Phone and tap on Build number several times until you are notified that it has been unlocked.
4. Set up your system to detect your device.
Follow the instructions below for your OS:
Windows Users
Install the Google USB Driver from the ADT SDK Manager
(Support for: ADP1, ADP2, Verizon Droid, Nexus One, Nexus S).
For devices not listed above, install an OEM driver for your device
Mac OS X
Your device should automatically work; Go to the next step
Ubuntu Linux
Add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, click here. To set up device detection on Ubuntu Linux:
Log in as root and create this file: /etc/udev/rules.d/51-android.rules.
Use this format to add each vendor to the file:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node.
Now execute: chmod a+r /etc/udev/rules.d/51-android.rules
Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules.
5. Run the project with your connected device.
With Eclipse/ADT: run or debug your application as usual. You will be presented with a Device Chooser dialog that lists the available emulator(s) and connected device(s).
With ADB: issue commands with the -d flag to target your connected device.
Sometimes you need to reset ADB.
To do that, in Eclipse, go:
Window>>
Show View >>
Android
(Might be found in the "Other" option)>>Devices
in the device Tab, click the down arrow, and choose reset adb.
in devices which has Android 4.3 and above you should follow these steps:
How to enable Developer Options:
Launch Settings menu.
Find the open the ‘About Device’ menu.
Scroll down to ‘Build Number’.
Next, tap on the ‘build number’ section seven times.
After the seventh tap you will be told that you are now a developer.
Go back to Settings menu and the Developer Options menu will now be displayed.
In order to enable the USB Debugging you will simply need to open Developer Options, scroll down and tick the box that says ‘USB Debugging’. That’s it.

Categories

Resources