Can't find my package path in file explorer - android

My project package doesn't show in DDMS > File Explorer (I had selected my phone in window devices). I found that an error is shown in logcat, which says can't open file for reading.
Is it possible that I didn't install Eclipse properly? Before that, my project ran well and I could see the project path in the file explorer (under data>data>). After I had make few changes (I don't recall what changes I had made, too many), when doing another project, I uninstalled and reinstalled Eclipse, then this error appeared. I can't find ALL my project package in file explorer.
May I know what is the problem and how to solve it.

This is due to the permissions, DDMS will only show the files and folders he has enough access to reach.
You can change these permissions using the tool Android Debug Bridge (ADB).
ADB is located in the folder platform-tools in your SDK directory.
On Windows you can access shell by opening a command prompt, go to the SDB path and use the following command:
cd (...)\android-sdk\platform-tools
adb shell
Once the command shell is opened, you can enter the command su - root to get root access.
To change permissions on files and folders, you just need to use the command chmod.
EDIT: here is an example showing gow to change the right on a specific folder, and all its contents:
chmod -R [permissions] [dirname]
R means recursive, if you remove it, it will only change the permissions of the folder, not its contents.
In [permissions], put the permissions desired, a full access is for example 777.
In [dirname], just replace with your folder name.
Example:
chmod -R 777 new_folder
This command gives full access to the folder "new_folder" and its sub-folders.

Related

How to access android root directory

I am developing an application using ionic framework.
The app creates files (*.json) and stores them in /data/user/0/ when i verify whether they exist or not, the result was true which means the files exist in the mentioned directory and I can access and modify their content without problem, but when I check the directory with a file manager or from the computer, no result, the directory is empty.
Could someone tell me what should I do?
use adb to copy the file. Even if it's in root dir, u should have access to it via adb.
Do adb pull data/user/0/filename.json path_on_ur_comp.json.
this will copy the file to the directory you define in the 2nd parameter.
// EDIT:
adb is part of the Android SDK, stands for Android Debug Bridge.
You can use this for MANY MANY different reason but of course, the "main" reason is to debug Android devices. You can use it to transfer files in your case.
In Windows, it's located here:
C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools\adb
In Mac, it's lcoated here:
/Users/USERNAME/Library/Android/sdk/platform-tools/adb
Depending on which OS you use, open that either with Terminal (Mac) or Command Prompt (Windows).
Once you do that, run the following command:
For Mac:
adb pull data/user/0/filename.json /Users/USERNAME/Desktop/somefile.json
For Windows:
adb pull data/user/0/filename.json c:\Users\USERNAME\Desktop\somefile.json
This will copy the file and put it on your desktop

How to run adb commands on a machine without admin access on Windows 7?

I did set up of Android, Java and Eclipse to start up my project but soon after running my emulator a few times I got error like “The connection to adb is down, and a severe error has occured.”
I referred to this question and got answer but while running adb from command prompt I am getting error as "'adb' is not recognized as an internal or external command,operable program or batch file."
How to run this adb commands without admin rights on machine?
but while running adb from command prompt i am getting error as "'adb' is not recognized as an internal or external command,operable program or batch file."
This is usually a path problem.
Linux
This is usually one of two problems on Linux.
First, adb is simply not on path. Its located in <Android SDK>/platform-tools, so platform-tools needs to be on path. To ensure its on path, you want something like this in your login script (.bashrc, .bash_profile, etc). Below is from Mac OS X and .bash_profile:
export JAVA_HOME=`/usr/libexec/java_home`
export ANDROID_NDK_ROOT=/opt/android-ndk-r9c
export ANDROID_SDK_ROOT=/opt/android-sdk-macosx
export PATH="$ANDROID_SDK_ROOT/tools/":"$ANDROID_SDK_ROOT/platform-tools/":"$PATH"
Second, the problem can occur on Linux if its x86_64 and you don't have ia32_libs installed. Tools like adb are 32-bit, so you need to install ia32_libs for the entire 32-bit subsystem for 64-bit Linuxes.
Windows
Windows has a PATH variable, and it can be adjusted per-user. Ensure <Android SDK>/platform-tools is on path in Windows. It would not hurt to ensure <Android SDK>/tools is on path also.
If you add a %PATH% variable, you can copy it from the System's %PATH% first. Then modify your copy.
You getting error like "'adb' is not recognized as an internal or external command,operable program or batch file." has nothing to do with your admin rights.
Follow the steps:
Go to folder location where your 'adb.exe' is located.
copy the path and open cmd prompt and paste your folder location
Example: C:\Users\298xxx>C:\Android\adt-bundle-windows-x86-20131030\adt-bundle-windows-x8
6-20131030\sdk\platform-tools\adb.exe
Run any adb command you want like
C:\Users\298xxx>C:\Android\adt-bundle-windows-x86-20131030\adt-bundle-windows-x86-20131030\sdk\platform-tools
\adb.exe devices
List of devices attached
emulator-5554 device
Problem is that in machine you need to set path of ADB.exe in system properties but you didn't had access as admin which don't allowed you to open/work directly with system related things like install/uninstall/path setting and many more.
Another way to do the same is
press ctrl+alt+del to open task manager
Go to File --> New Task -- > and copy paste the path of you adb.exe (space) devices to check for devices attached to your machine.

what is the default working directory for adb push/pull and how do I change it?

I pulled out a file from the android sdcard using adb and it seems it goes to c:\documents and settings\userName by default. I don't know how it got set to this folder since this is not where adb is installed, but probably has got something to do with the fact that both the workspace and .android folders are located here. How do I change this default location for pull command of adb?
The default directory for adb pull or adb push seems to be the current directory (aka . ).
If you issue a command such as the following, not specifying the target directory
adb pull /boot.txt
the file (provided it exists) will be copied to the current directory.
Windows users:
Take notice of the following: If you are using Windows (Vista or newer), chances are that if the current directory requires elevated privileges to write on, Windows will silently replicate the directory structure of your current directory in a special folder called VirtualStore and will copy your files in it.
The full path for VirtualStore is: %LOCALAPPDATA%\VirtualStore, which most likely will translate into C:\Users\<account_name>\AppData\Local\VirtualStore.
So, in the following scenario,
C:\> cd "C:\Program Files (x86)\MyCustomADBInstallLocation"
C:\Program Files (x86)\MyCustomADBInstallLocation> adb pull /boot.txt
your file boot.txt will end up in this folder
C:\Users\<account_name>\AppData\Local\VirtualStore\Program Files (x86)\MyCustomADBInstallLocation\
you can mention the destination location for adb push/pull, see example:-
adb push a.txt /data/local
adb pull /data/local/a.txt .
. means present directory.
or
adb pull /data/local/a.txt C:\
Hope this helps.
i'm using linux, and noticed that if i opened the terminal as root, its opened # home. when i pull items, it dumps to that repository, meaning to my "home" directory. will try opening terminal in a different folder and running adb pull from there to see if that makes the files dump to the folder terminal is opened in.

Android get .apk file from emulator

I am newbie to the android development. Just out of curiosity i was wondering if it is possible to get back installed .apk file from android emulator ???
The question linked by #thepoosh indeed has some correct answers to your question, but it is not the accepted answer. Scroll down a bit to answer of either #plaisthos or #Pratik.
In short: your .apk resides in the /data/app directory on your emulator. Note: It probably has a name that differs from the name of the .apk file on your build machine, since the .apk get renamed to something that looks like your package name.
So, using adb shell:
- cd /data/app
- ls (and check the name of your .apk file)
- exit adb shell
- on commmandprompt: adb pull /data/app/your.filename.apk
Or from Eclipse use the fileexplorer tab as stated by #Pratik in the other thread.
you can copy the route if you are working in eclipse, the apk that you install in the emulator is the same that is in your project when you compile it, go to folder bin, select .apk ctrl+c and paste in your desktop for example.
How to extract the apk file from device:
First run your emulator.
if you are in windows, open cmd and go to platform-tools : in my case
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
after that run adb as:
adb pull /data/app <the directory where do you wannt to save>
example:
adb pull /data/app C:\Users\tato469\Desktop\app
Access this folder and select your app.
NOTE: Look if only one emulator is running, else it will throw an error.
Are you trying to run the app on a device or do you just want the .apk?
TO run it on a device:
1) Click the project
2) Go to Run -> Run configurations -> Target tab
3) Select Always prompt to pick device then apply.
After which everytime you try and run the application it will let you select any plugged in devices
TO get the .apk
1) Right-click project file
2) Export
3) Follow instructions

how to copy a file stored in /data/data/com.sai.myproj/files/a.txt to res folder in Android

I have a file stored in /data/data/com.sai.myproj/files/a.txt .This is the file I created and wrote data, it was stored in data/data/com.sai.myproj/files/a.txt which can be viewed using FileExplorer of DDMS. How to copy this file from there to res folder as I need to parse this file .
Can anyone help me in sorting out this issue.
Thanks in Advance,
You can use adb pull on your computer:
adb pull /data/data/com.sai.myproj/files/a.txt your-project-location/res
Adb is located in android-sdk/tools.
AFAIK an installed application cannot write to its own res folder
If you want to copy something from a device into the res folder of your project sources, you can use the adb tool, either from the command line by programmatic usage of the command line as part of a script or .bat file or using the shell exec function of your chosen language on your chosen development platform
Make sure you have the SDK fully installed and that the adb executable is in your path or reference it by its full path name (ie, make sure 'adb shell' works)

Categories

Resources