"No media found". How to insert image in android - android

I am new to android programming so I will be really grateful if someone helps me.
I am trying to implement steganography in android but my problem is I don't know how to insert images in android. Because of which I am getting "No media found". Please help me with this.
I tried
c:> adb push c:\image1.png /sdcard/image1.png
But I get this in the Command Prompt.
failed to copy 'c:\image1.png' to 'sdcard/image1.png' : Read-only file system

I had the same problem, so in case anyone lands on this page here is how I solved it
When creating the emulator device (I use IntelliJ IDEA) - do not forget to move the radio button on SDCard option to the Size option, and specify the needed size, this way a new SDCard will be created and mounted to the emulator. In eclipse there are some command line parameters you can pass (or something else, I am not sure, since I read it only on the stackoverflow).
After that I stopped receiving the "Read-only file system" error, but I tried and tried and tried copying the files to the sdcard using:
adb push image.jpg /sdcard/image.jpg
or
adb push image.jpg /mnt/sdcard/image.jpg
but was receiving "No media found" error in my app or when I went to the gallery.
So I went to Dev Tools on the emulator applications, then to the Media Scanner. It quickly scanned the sdcard, and boom - I finally got to see my images.
Hope this helps :)

The correct directory for my emulator is mnt/sdcard. This works for me:
adb push README mnt/sdcard
Also note that you can explore directories using adb shell ls <path>, which might have tipped you off to the right path.
Edit - apparently sdcard is a symlink to mnt/sdcard and works for me as well. Using a file named image1.png is also working. Maybe there is a problematic file already located at that location for you?
Edit 2 - I think you also need to have the USB mounting option turned off when you use adb to push files. It sounds like you have this on given your comment about the gallery not finding your media.

Related

Device is not showing in Android Device Monitor?

Files under the device are not visible please tell me something about it
I also uploaded the screen shot of it.
You can pull files from android device using adb command line tool. I don't know which file you exacly want. In case of sqlite database, it is stored in //data/data/<your app>/databases/<databaseName.db>. Probably you will need to be root to do that. Many files are hidden and inaccessible when you don't have root privileges.

in an AVD I can't seem to get the sdcard to work

I've created an AVD, got it to work fine except when I try to add an sdcard to it it doesn't work. I don't get an error message or anything but when I push files onto it, they don't show in the gallery. Someone on a different post suggested just downloading a pic off the internet instead of trying to push one on so I tried that and got an error message that said
"No SD card
an SD card is required to download 01.jpg"
I've tried every solution I could find including going through the CMD and remounting the sdcard. Nothing worked. Any ideas? Why does it say "No SD card" when I already added it to the AVD? Why does it still say that after I've remounted it, which apparently is the only way to make it so I can push files onto it. That's how I got a different error message to go away! This thing has been one major headache after another! Once I solve or find a work-around for one problem another pops up almost instantly!!
Same problem i also faced but i got solution with following steps
1) AT the time of creating new AVD you have to give value in SD Card.
2) After starting the AVD insert the image that you want in AVD.
3) Next restart the AVD
Note : Enter SD Card value from 10 MB onwards if you give more it may not start AVD it will keep showing android.
this solution is worked for me, hope this will helps you.

Open a file to view the content through adb. (Android, Eclipse)

I have recently created some code which writes just some text to a file called 'config.txt', however; I want to be able to open this textfile and view its contents.
I have navigated to the file through the eclipse file explorer, but found you can't actually open the file from there.
Which commands do I need in order to open this file and view its contents?
I know this question has been asked before, but I have not yet found any commands which do not lead to an error message; or simply nothing happening.
Thanks for any help.
Callum
UPDATE
I think I have just answered my own question.
I did not realise that in the top left of the file explorer window, there is an icon which allows you to pull selected files from the device to your computer.
You'll probably need to download that file form your AVD to your computer via the "pull a file from the device" symbol in the top right corner first.
By the way, I asked a question about working with files in the AVD a few days ago. Unfortunately, I got no answer but there are some links in that question that might help you choose the way you prefer. So if you're interested: https://stackoverflow.com/questions/24013091/avd-android-virtual-device-sd-card-file-management
You could use adb from a command line if you are familiar with that (or willing to learn). :)
adb pull <remote> <local> would get the file similar to what you did with the GUI.
Or open an adb shell and read it from that session: cat <filename>.

Loading Android Kernel modules

After weeks of mucking around i have (i think) successfully compiled g_hid.ko (USB Gadget HID module) for my Samsung Galaxy S3 but have been unable to test it. If i try and use insmod from the directory it is stored in i get insmod: can't insert 'g_hid.ko': No such device I'm new to this but i think this means that i should have loaded something else that g_hid is dependent on first. Any one know what this would be or how i can find out?
Also when trying to use rmmod i receive the following error rmmod: chdir(/system/lib/modules): No such file or directory which is true, that directory doesnt exist, as far as i can tell, my modules are stored in /lib/modules but this is a read only file system so i cant add my modle there. I also get the same error if i try and use modprobe. Any help you can offer would be greatly appreiated.
Thanks
Adrian
I eventually got this to work. The continual discussion on the topic is at Is it possible to program Android to act as physical USB keyboard? and http://forum.xda-developers.com/showthread.php?t=1871281 When i have some free time in a few weeks (after uni) i intend to write up how i did every thing as there appears to be a lot of interest.
Regarding the inability to place the module into system/lib/modules... You must first connect to the device and issue the commands:
adb root
adb remount
After issuing these commands you can place your .ko into the correct directory and the "read only file system" problem will go away.

Android file explorer - Eclipse

I am saving data internally to the phone in Eclipse, and I was told the file that it was saving to was located here. I try to open the file by double-clicking it to see the saved data, but nothing comes up. What am I doing wrong?
I am trying to check that it is saving to the file properly. I am trying to verify that it is saving the text here since I am not sure where else it is saving it.
I have tried pulling it, and saving it to my desktop, but all I get is this error:
Failed to pull selection
(null)
The DDMS file explorer LOOKS like a windows file explorer, and so you think you should just click on things and drag them around and so on.
Unfortunately, it isn't. It LOOKS like that but it IS NOT that.
From the Using DDMS page we find:
To work with an emulator or device's file system:
In the Devices tab, select the emulator that you want to view the file system for.
To copy a file from the device, locate the file in the File Explorer and click the Pull file button.
To copy a file to the device, click the Push file button on the File Explorer tab.
Which is to say, you have to use the buttons to copy the file off the phone on to your local filesystem. From there you can read it using all the double clicking and dragging you are used to.
I'm guessing you viewing the file from the file explorer in the DDMS. Once you located the file there's a couple buttons on the top right corner to pull/push files from the device
Pulling the file from the device via the File Explorer is the correct way. Not sure why is it failing. Real phone or emulator?
There's another way though. There's a program called ADB in the Android SDK; it's under platform-tools. Run it with the following parameters:
adb shell cat /data/data/com.mypackage/files/textfile.txt
The package name will vary, obviously. This will print the file contents to the standard output.
EDIT:
Press Windows key+R.
Type "cmd", click OK.
Type or paste the following line:
C:\android-sdk-windows\platform-tools\adb shell cat /data/data/com.mypackage/files/textfile.txt
replacing the com.mypackage name with the name of your app's package, which I cannot possibly know. Also replace the path to the Android SDK, if needed.
Press Enter.
Watch the output.
EDIT2: by the way, are you closing the stream after writing the data? That could be the reason you could not pull the file via the File Explorer.

Categories

Resources