Create SD Card for Emulator built from Android source code - android

I have built the Android source for the emulator. I need to add sdcard to this emualtor.
Following are the commands, I use after the first full build:
source build/envsetup.sh
lunch 1
mmm packages/apps/MyApp/
adb sync
adb remount
However, I am unable to see the emulator in /mnt/sdcard path
What are the steps or commands, I need to use, in order to create an sdcard, when I use the emulator(with the commands above) built from Android source code.
I have been stuck with this issue for sometime. Any help is much appreciated.

after executing
$ make -j4
execute
$ mksdcard -l mySdCard 1024M mySdCardFile.img
and then
$ emulator -sdcard mySdCardFile.img

You have to go to the Android Virtual Device Manager, create your own or use an existing one and click the "Edit" button.
Then add some MB to your virtual SD Card.
Once started you can go to DDMS tab, then File Transfer tab and SDCard folder ;)

Related

Android Studio - Android Device Monitor's File explorer not working

I have just learnt using preferences in Android. For debugging purpose I need to access the preferences files. I googled and found the default location of the preference file and also how to access it via Android Device Monitor.
Somehow I am not able to open any folders under the File explorer tab of the Android device monitor. They just aren't responding. I tried waiting for ADM to load and tried again but no success. (Double click on folder is not working, STRANGE!)
Do we need to configure before using it? I am using Android studio.
Any help would be appreciated.
Attaching image
Finally I found how to make it work.
goto run -> location where your adb is
Ex: C:\Program Files (x86)\Android\android-sdk\platform-tools
type adb root , Enter (Your phone must have root)
If this doesn't work, install this app on your phone: [root] adbd Insecure or its free alternative here (update: link broken now).
Get more info at http://forum.xda-developers.com/showthread.php?t=1687590
You will need either to use the emulator or to have a rooted phone to use all functionalities.
Root your device and open adb shell and change the permissions as:
$ adb shell
$ su
1|root#android:/ # chmod -R 777 data/

INSTALL_FAILED_CONTAINER_ERROR on installing a game on AVD

I tried to install a game in my AVD(Android Virtual Device).
Using adb install xxx.apk I got above error.
I set 2 GB Internal Storage but in AVD I have only 190MB and I set 3 GB SD Card.
Try to create a new avd
how to create a new AVD in eclipse?
http://theopentutorials.com/tutorials/android/how-to-create-android-avd-emulator-in-eclipse/
try out the following procedure
copy your apk file into platform-tools of your android sdk it can be like C:\android-sdk\platform-tools.
now go to command prompt and change the path to platform-tools the write a command as follows
cmd -- adb install (appName).apk
it takes few minutes and gives you success response in cmd prompt..
and there were many links to guide you, you can go with this reference
http://www.android.pk/blog/general/how-to-install-apk-files-on-android-emulator/

Eclipse console shows:'Failed to push selection: Read-only file system'when i try to push a file

I am trying to push a file to the SD Card but its showing error in console 'failed to push selection: Read-only file system'.I am using DDMS perspective in Eclipse.I generated sdcard using mksdcard command.
Just go to
C:\Documents and Settings\<adminstrator>\.android\avd
take 'properties' of your avd folder (there is a folder for each of the avd's)
uncheck 'Read only' -> OK
This was the only thing that worked for me.
P.S: Some of these folders might be hidden.
On the Terminal or Command-Prompt, write these( for me its command prompt ):
adb shell(Opens the device shell. you'll see a #)
su(get the root permission, if necessary)
mount -o rw,remount rootfs /(remount the root file system.)
chmod 777 /mnt/sdcard (change the permission of the sdcard to rwe.)
exit
If it doesn't work, try to push the file from the same shell using adb push .
Hope this help.
You need to give SDCard support to your AVD and mount the SDCard.
First go to 'AVD Manager and select your AVD then Click on Edit and in the Hardware add SDCard Support'.
Please check this link for complete detailed step to achieve SDCard support and mounting.
You can also give a try to this command in CMD, this will remount your SDCard.
c:\android-sdk\platform-tools\>adb remount
I was also facing same issue :
Failed to push selection: Read-only file system
In computers with higher configuration(beyond Windows XP)
settings like ---> C:\Documents and Settings\.android\avd
doesn't exist so instead
go to this path --> C:\Users\.android and right click on this folder and uncheck the box having name as read only.
Hope this helps those with newer windows on their pc :) , if this solution helps you than please vote for it.
In my case i have mistake with the slash.
while specifying "Additional Emulator Command Line Options" in eclipse
Actually it should be -sdcard C:/Kamal/sdcard/emulator_sdcard
and i was putting -sdcard C:\Kamal\sdcard\emulator_sdcard
Then after restarting the Eclipse & Emulator it works.
If the data in the sd card is not updated in the emulator or in the app which you are developing then,
Select,
Dev Tools->Media Scanner
The data which has been already pushed into the sd card by variant means will get loaded soon.!
if some one have same problem in new build of studio . 0.8.9 and above see my solution here and it will work like a charm : (afra mehrparvar solution in the bottom of the page )
Android Emulator sdcard push error: Read-only file system

Patching a file into system.img for use with android emulator

I need to patch a file into the system.img file used by the Android emulator, specifically I want to add an ARM binary to the /system/bin directory.
I have this binary pre-compiled and it works in my emulator perfectly, but I can't simply remount system.img as rw and adb push it because the change is non-persistent across reboots. I tried this on a copy of system.img and passing it to the emulator with -system but that was non-persistent to sadly.
In the ideal world I want to modify the "make sdk" process so that the sdk build process automatically includes my binary when it produces system.img. Can this be done?
If this isn't possible, is there anyway of patching it into the image manually?
Thanks a lot.
I was interested in permanently modifying the /system folder and tried unpacking the system.img file which went ok, but I failed to create a new img that the emulator was happy with (using the mkyaffs2 and unyaffs2 tools to extract and create a new system.img).
Instead I found a much easier solution:
Remove everything from the /data/ directory (except lost+found)
Copy the contents of /system into your /data folder
Make your desired changes to /data/
Kill the emulator
You now move your ~/.android/avd/MYANDROID.avd/userdata-qemu.img to ~/system.img (or wherever)
and startup your emulator with your new system image:
emulator -debug all -show-kernel -verbose -avd MYANDROID -no-boot-anim \
-gpu on -partition-size 800 -system [path to your new system.img]
The /data folder is where the userdata-qemu.img file gets mounted.
It gets created the first time the emulator is run and will get recreated if you delete it.
(though your installed apps will disappear).
BY populating it with the contents of the /system folder and then making your desired modifications you have created a replacement for the system.img file.
system.img replace with original one so you need give patches whenever your emulator boots check logcat & then using ADB push you manually push the patches.

Moving files to SDcard on Android

How do I put a file onto an sdcard using command line? I tried by using the adb push command but it's not working. My file is in D:/sample.ogg. I have written:
adb push sample.ogg/sdcard/sample.ogg
It's not working. Any help would be appreciated
Thanks
In Command prompt type the following...
mksdcard -l test 10M c:/test1.img
try starting the emulator and loading the SDcard from command prompt by typing...
emulator -sdcard c:/test1.img
once emulator is started open another command prompt instance and try copying a file to SDcard by typing
adb push e:/test.png sdcard/test.png
Later try retrieving the same file from sdcard to your system by typing
adb pull sdcard/test.png d:/
see if the file has been copied in your d:/ ..try and tell me if it works for u:)
You can check my post here
http://www.anddev.org/error_while_writing_on_sdcard-t2997.html?sid=c01c1a23f34eb6bb7f97b6af99ca9816
Edit--
In the newer Android SDK's you can directly create an SD Card and start your emulator from your AVD in eclipse. You can neglect step 1 and 2 in that case and try push and pull commands directly
In your case it should be
adb push d:/sample.ogg sdcard/sample.ogg

Categories

Resources