ADB push command android emulator - android

I am trying to import a python library into SL4A. From my understanding, the easiest way to do this is to import the zipped files (egg files) of the python library into the SD Card and then import it into SL4A. Since I do not have an android device yet, I am working with the emulator. Whenever I try to push the zipped folder using the adb push command, it pops out an error saying the device is not connected. How do I push zipped files into the SD Card of an emulator and then access it via SL4A ? I want to use the commands in that library in the command line in SL4A.
Thanks !

You can create your own sdcard image, put files on it and after that mount in emulator.
To create image you can use mksdcard <size> <file>: mksdcard 1024M sdcard1.iso. After that you need to mount sdcard: mount -o loop sdcard1.iso /mnt/cdrom/. Next step: copy files, umount /mnt/cdrom/ and point to image in virtual machine properties.

Related

How to copy file using adb to android directory accessible from PC

If you attach android device to PC you can browse files and dirs. It is possible to get this directory using Environment.getExternalStorage(). You can use it from your application and create accessible files and dirs. It works fine.
On my devices this path looks like /storage/emulated/0 and if i try adb push to this directory i will get access denied error. Is it possible to copy files using adb to the same folder as Windows Explorer does?
D:\...\tools>adb push ACCOUNTS.DB /storage/emulated/0
failed to copy 'ACCOUNTS.DB' to '/storage/emulated/0': Permission denied
58969 KB/s (606505 bytes in 0.010s)
I'm implementing automated import/export and i want files to be accessible without adb shell in case anything will go wrong.
Currently using variable$EXTERNAL_STORAGE as workaround, it works for both adb and application.
Device: Asus Fonepad 7, Android 5.0, tried Genymotion Custom Tablet 6.0 - works.
Try to use /sdcard/. Although it is strongly discouraged to do this in code. It seems to be the only way with adb :
$ adb push somefile /storage/emulated/0/somefile
[100%] /storage/emulated/0/somefile
adb: error: failed to copy 'somefile' to '/storage/emulated/0/somefile': Read-only file system
$ adb push somefile /sdcard/somefile
[100%] /sdcard/somefile
By the way, on my device they don't have the same value : Environment.getExternalStorage() points to /storage/emulated/0/ while /sdcard points to /storage/emulated/legacy.
It's pretty easy, internal storage is unavailable on non-rooted devices. So as was mentioned in bwt answer you just need to push your data to sdcard :
adb push somefile /sdcard/somefile
With retrieving files from your filesystem you'll also have few problems. But with the case of pulling a database from a debug application - you'll just need to change file permission via chmod.
Here you have a useful link - XDA guys about adb

Create SD Card for Emulator built from Android source code

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 ;)

How to copy file into /data?

I use T2Q210 versions and android 4 systems.
I try to copy executable file lcd into sd card, then copy in /data. But there is not copy command in android. I try mv. But it hints device link error.
I try cat lcd > /data/. There is lcd in data, but file lcd Execute failure.
My problem is:
How to copy file in /data?
Is my lcd file des break down when cat?
Is android could execute the linux executable file which I cross compile?
You don't have write access of /data folder unless your device is rooted.
However I found I have write access of /data/local/tmp on my Samsung S4 running android 4.3.
So please try :
adb -d push your_exe /data/local/tmp
adb -d shell
/data/local/tmp/your_exe

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

how mount userdata.img or userdata-qemu.img in osx

Disk Utility in OSX easily mounts an SD Card image as a device, but not so the other img files.
I want to get the database I just created in the Android Emulator off the drive and into my osx file system.
I updated my system with qemu using macports but no combination I try succeeds. Anyone figured out how to do this?
Obviously one way I can do this is run the app on my phone than mount the phone as a USB drive. But I don't wanna. I wanna get it off the drive the emulator uses :-)
Thanks in advance, folks.
Michael
Can't you just use adb to pull the database off of the emulator? I actually just answered a similar question... here it was:
The database for a specific app lives in /data/data/[packagename]/databases
The packagename is the package you define in your manifest, for instance /data/data/org.vimtips.supacount/databases/counts.db.
You can view it with adb shell and type sqlite3 /data/data/org.vimtips.supacount/databases/counts.db
Or you can pull it from the device to look at it with a third party utility, with a command like adb pull /data/data/org.vimtips.supacount/databases/counts.db ..
Use the File Explorer in DDMS (from Eclipse SDK), you can see the whole file system there and download/upload files to the desired place. That way you don't have to mount and deal with images, and no adb commands either

Categories

Resources