in Android Studio I can save a file in the directory on my emulator/virtual device
/data/user/0/appname/files/test.txt
but when I start the app on a real device Xiaomi MI A2 - there is no such directory
and Android Studio throws a file not found exception
I tried Device file explorer - no such directory
Any help?
Related
Is there anyway to change the default 'Save as...' folder of Device File Explorer Android Studio 3.0 and above ?
I want to pick a file from my virtual device into my PC, but an error happens, I guess it relates to the permission.
Error saving file(s) to local file system: Cannot create directory
C:\Users\ABC\Documents\AndroidStudio\DeviceExplorer\samsung-samsung_sm_n900a-127.0.0.1_6555\data\data\moneymanager.app.com\files
For Googlers: Since some version of Android Studio, Device File Explorer's default saving location can be changed in Settings - Tools - Device File Explorer - Download location.
I haven't found the option to change directory as such but to actually pull the file from the Device File Explorer I recommend the following steps:
Change the folder permissions through adb shell.
Pull the file using "adb pull". See example:
C:\Users\B\AppData\Local\Android\sdk\platform-tools>
adb pull /data/data/com.example.b.expensewatcher/databases/myexpenses.db
/data/data/com.example.b.expensewatcher/databases/myexpenses.db: 1 file pulled. 3.3 MB/s (24576 bytes in 0.007s)
For more details:
https://www.dev2qa.com/android-device-monitor-cannot-open-data-folder-resolve-method/
I'm learning how to integrate databases (SQLite) into my app.
I checked out this tutorial and at the 10m mark, OP enters the FileExplorer in Android Device Manager in Android Studio.
Can't see ANY files in the File Explorer. Using the File Explorer is the desired result. Last Night, I've Rooted my Nexus 6p (7.0) and reinstalled Studio 2.2.2 after reading these stackoverflow dialogues with no desired result, the issue has a long history:
1) Android Device Monitor "data" folder is empty
How to Find my App's /data/data using Android Device Monitor's File Explorer
-Rooted phone (6p) doesn't show any files in FileExplorer (Verfied with Root Checker)
-Emulator doesn't show anything in FileExplorer
2) How to access data/data folder in Android device?
How do I view the SQLite database on an Android device?
SQLite database cannot be accessed although device is rooted
Android Studio - Android Device Monitor's File explorer not working
Android: No files appearing in File Explorer
a) adb shell
run-as com.your.packagename
Has corrupt installation - maybe it's me
b) adb shell
su
chmod /data /data/data /data/data/com.application.package
bad mode '/data'
Nothing, doesn't show any files in FileExplorer
c) adb shell
su
chmod 777 /data /data/data /data/data/
Nothing, doesn't show any files in FileExplorer
d) adb shell
su
chmod -R 777 data/
Nothing, doesn't show any files in FileExplorer
3) How can I see the contents of a sqlite db of my app in a real device?
Nothing, doesn't show any files in FileExplorer
4) http://forum.xda-developers.com/nexus-6p/help/android-device-manager-7-0-nougat-t3454419
Maybe it's not just me, and something is wrong with Nougat 7.0, but there seems to be a continuous stream of the same issue.
Any help would be greatly appreciated. I'm tempted to restart my application and try IntelliJ or Eclipse but I'm not sure if that would solve my problem.
There's nothing wrong with me (good sign of validation) but a problem with the emulators targeting Android 24 or 25.
Issue re-reported back in Oct '16:
https://code.google.com/p/android/issues/detail?id=225049. Faith that Google will resolve this issue as soon as possible.
For now, the solution is to run your emulator using API 23 and there should be no problem accessing the File Explorer with the data using Android Device Manager.
Hurray!
Apparently the solution to your question is No Solution till date.
This is a bug which many android developers had raised.
1.
https://code.google.com/p/android/issues/detail?id=229628
2.
https://code.google.com/p/android/issues/detail?id=225049
3.
https://code.google.com/p/android/issues/detail?id=226984
So if anybody is facing this issue, use emulators targeting Android 23 or its previous versions..
A new tool window has been added to Android Studio 2.4 (currently in canary) that will allow you to interact with API 24 devices and emulators directly in Android Studio. Once you have updated to 2.4 canary, you can find the tool window in View > Tool Windows > Device File Explorer.
I have install Eclipse, SDK and ADT in my machine.
Can anyone assist me how can I run .apk sample files in Eclipse?
Thanks.
You ofcourse cannot open the .apk file in your eclipse IDE. You need to install it on emulator as like we install it on our devices.
Go to your Command Prompt, type
adb install Sudoku.apk and it will install it on your emulator. (Remember, load the adb to your path variables and change your directory location where you have already placed the Sudoku.apk)
You need to create an emulator using the Android Virtual Device Manager. Then when you run it as an android application it will launch the emulator.
http://developer.android.com/guide/developing/devices/index.html
Should cover what you need to know.
you can push a file in emulator by Eclips( and you device that connected to eclips)
1-in device tab select your emulated phone and start it
2-pushing your apk file in file explorer tab by clicckig on PUSH A FILE
It Works.
I installed all the prerequisites for Android development. I created a virtual device through Eclipse and tried to run the Hello World sample application in that device. I received the following error message.
emulator: ERROR: unknown virtual device name: 'Android21Device'
emulator: could not find virtual device named 'Android21Device'
I get the same error when I try to start the device from the command line and through the SDK program.
I can see the device directory and files at
D:\Users\anthony\.android\avd\Android21Device.avd
Android Virtual Device Tool
The Virtual Device tool in the SDK Manager creates virtual devices in your user profile directory... in this case a secondary drive
D:\Users\anthony\.android
But, the emulator tries to load virtual device images from the system drive
C:\Users\anthony\.android
Directory Junction
There are two workarounds. First, you can create a directory hard-link (or junction) from the system drive android folder to the one in your user profile. In Windows 7, you can use the following command
mklink /J C:\Users\anthony\.android D:\Users\anthony\.android
Android Home
The Android SDK Manager and emulator can use an environment variable ANDROID_SDK_HOME to identify the location of the .android directory. Set a user or environment variable
ANDROID_SDK_HOME = 'D:\Users\anthony'
If you find:
emulator: ERROR: unknown virtual device name: 'Android21Device'
emulator: could not find virtual device named 'Android21Device'`
Just change your environment variables in the path in which your .android is found.
create your avd name such as hello in android sdk and avd manager
start launch then if you find the error like above
open the details
see the path and copy the path example of path C:\Users\\Contacts.android\avd\hello.avd
open your variable environment by start->computer>right click>properties>advance system setting>variable environment> system variable>
see in the system variable where the variable is PATH then edit
click the variable value then add the C:\Users\\Contacts.android\avd\hello.avd preceded by a semicolon(;). For example: C:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Users\<something>\Contacts\.android\avd\hello.avd
ok.then restart your computer...
open eclipse then start your avd again...
You need to restart eclipse after closing it. File -> Restart will not help.
I was also getting the same Error and My resolution is below
Setting the ANDROID_SDK_HOME----Not worked for me
Creating Directory Junction-----Not worked
Now I went to the .android folder which has been created in some other location, open the avd and .ini file of the avd and edited it with the patch which system wants i.e "C:\Users\.android" and this worked for me :) yupiiii
i want to load some photos into my sd card image in the emulator. how to do this by command prompt.how to do that?
I've found it to be incredibly clumsy and not work very well, but the command to use is: adb push yourfile.xxx /sdcard/yourfile.xxx. For this to work you've got to have the file in the same directory as adb.exe, which is in the tools folder of your SDK directory, or have set up adb as a system-wide recognisable command. (I don't remember how to do that, but I know it can be done). This also assumes you've set up an SD card through the AVD manager. However, the problem I faced when doing this is that sometimes the file would appear on the emulator with a size of 0 bytes. What I mean is that I could see the file in the DDMS file browser in Eclipse, but after doing the necessary emulator restart, the files would then be shown with the 0 byte size. I couldn't find a pattern on why that happened, but trying a few times in a row eventually worked.
I've just found out how to add some files in the SD card image.
Turn all running emulators off but keep Eclipse on.
Using thecommand line, start the ddms tool. ddms
Now start stand-alone emulator console.
emulator -avd myAVDname -sdcard mysdcard.img
Push a file into the sdcard. adb push yourfilename /sdcard/
You should get a message (how much memory it occupies)
In Eclipse, you will see the folders (including SD card and the files you just add) appear.
For me, the files didn't appear at the first time in File Explorer, then I closed the emulator and turned it on again. Now it works!
On Android Studio
Run Emulator
open android device monitor
scroll down and select sdcard
Click on Push file into sdcard icon at top right
choose the file
Hope this helps..
in Eclipse, Open the DDMS Perspective.
Start an Emulator. Select it in the Devices.
Click on the File Explorer Tab in DDMS.
THEN THE FOLLOWING DOCUMENTATION FROM OFFICIAL ANDROID WEBSTIE: http://developer.android.com/tools/debugging/ddms.html
Working with an emulator or device's file system
DDMS provides a File Explorer tab that allows you to view, copy, and delete files on the device. This feature is useful in examining files that are created by your application or if you want to transfer files to and from the device.
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.
Answer here also. You need not open cmd when using eclipse.
Problems trying to push files into android device using eclipse
You can use the ADB via a terminal to pass the file From Desktop to Emulator.
adb push <file-source-local> <file-destination-remote>
You can also copy file from emulator to Desktop
adb pull <file-source-remote> <file-destination-local>
first,download magiciso(http://www.magiciso.com/Setup_MagicISO.exe)
after downloading When your emulator is not open go to your avd files(c:/document and settings/"user name"/.android)
there is your avd named folder
then open sdcard.img with magiciso
now you have to drag and drop files in your magic iso window
don't forget to save the file