What and why some files are installed in data/local/tmp - android

I am making one app on Android and I have no idea what is doing one file which is installed after app installation. This file is quite big (this is about this same size as installed apk - even after uninstall ~ 5MB) so this is the reason of my question.
he file is set in data/local/tmp/'name of my apk'.apk
What is it and when it is deleted, because when I'm testing my app on emulator and uninstall it then it still exists.
EDIT AND ANSWERS:
I am not sure of my app is using tmp files. The only file or resource my app is using is movie placed in resources folder which is around 5MB. Deleting this file after app uninstall brings back free space. Before uninstall no. But I want to have deleted it melodramatically or not created at all because this file makes me app 2 times bigger.

The files in there are temporary files and you can safely delete them.
For instance, these are created when you:
Install an APK trought the command line with adb install (the temporary file will have the same name as the original file);
Install / Run an application through Android Studio (the temporary file will have the application package name).
To easily list all the temporary files, you can use the following command:
adb shell ls /data/local/tmp
To remove all of them, you can just use the following command:
adb shell rm /data/local/tmp/*

The .apk is your application. You'd be Sad if Android deleted it behind your back :)
http://developer.android.com/guide/developing/building/index.html#detailed-build
http://www.ibm.com/developerworks/xml/library/x-androidstorage/index.html

This file is the uploaded apk on emulator. Like normal file upload on device.

Related

Unable to Extract .apk files from Bluestacks app player using adb

I'm trying to extract .apk files of my apps installed from blue stacks player using adb .I am successful in getting the .apk's of files that are present in the location "/system/app". Below is the command that i gave from my command line
adb pull /system/app C:\xyz\ffff
However,When i am trying to get the .apk of the apps that are present in the location "/data/app" it says
"0 files pulled"
However,I'm pretty much sure it has got over 10 apps.
Any help would be highly helpful
1.Download 'apkextractor' app from playstore and install it in your bluetack, This application can extract the applications installed in bluestack
2.To access this .apk files you need any filemanager, And go to extractedApk directory
3.To move apk files from bluestack to pc folder, Move the .apk files from 'extractedApk' to 'windows/pictures' folder
This screenshot will help you
In the latest versions of Android, APKs are no longer simply stored in the /data/app folder.
To get the list of installed packages (and their paths) run the following:
adb shell pm list packages -f
This will show you packages and paths to the APKs. Like this:
package:/data/app/com.android.chrome-2/base.apk=com.android.chrome
Here, you can see the APK resides at /data/app/com.android.chrome-2/base.apk
Running adb pull /data/app/com.android.chrome-2/base.apk works.
You need to do this for each APK shown in the package list. On non-rooted devices, you cannot search for APKs in the /data/app folder because adb does not have permission to view the contents of folders in this location.

How to extract .apk file and put it into Eclipse for running?

I am quite new in Android and I intended to run some sample programming downloaded from the web, but I faced problem in extracting the .apk file, in the .apk file there are META-INF, res, manifest, .dex and .arsc, how I am going to open the sample program in the Eclipse? I just wanna run some sample coding... Thanks.
You don't need to open the program in eclipse to run it.
Just type
adb install -r filename.apk
The -r flag is to allow re-install if it already exists with the same signature. If it exists with an incompatible signature you will have to remove it.
If adb complains you have multiple devices, do
adb devices
Notice the serial number of the one you want, and then
adb -s SERIAL -r filename.apk
Actually opening an existing apk in eclipse would be relatively pointless without a depackager/decompiler, which is another topic altogether.

Android ActivityManager: am: not found (file not in /system/bin)

I'm working in eclipse and trying to use my phone (HTC Thunderbolt) for development for the first time (because the emulator is too slow).
In Eclipse I get the error:
Android ActivityManager: am: not found
(The error is after Android Launch!, adb is running normally, and Success!, etc.)
Using adb shell, I see that the am file is not located in /system/bin or anywhere else that I looked. I'm running a custom ROM on my phone. Is it possible the file is simply not present? If so, can I push it to my phone? How?
Thank you
EDIT: Using adb shell, from /, I ran ls -R | grep "^am$" and there is no file named "am".
I have seen posts like this one where they mention an error message like system-bin-sh-am-not-found, but in those cases the file is actually present and needs to be edited. In my case, the file is not present. Anyone have a copy of /system/bin/am for Gingerbread? Is it the same for all devices?
Look into your bin folder, there should be a file named after your project followed by .apk
example. project name = mountainx, the file is mountainx.apk
copy that into your handphone storage, then install it from your phone via application installer or any other applications that can access the apk file
The problem was related to the custom ROM I was running. The ROM cook had not included that file in the ROM.

How to install the new apk file without uninstall the old apk file on an Android device?

My apk file size is 2MB. First time installing the apk file in the device there is no problem.
Suppose some changes in the application after that generated the new apk file. I am try to install the new apk file in the same device then it shows some message first uninstall the previous one(i.e. , same application) in the device. But small apk files, I am not facing this problem.
Is it possible to install the new apk file without uninstall the old one?
It is not connected with apk size but with the fact that the old apk was signed with different key than the new one. So you must uninstall it before installing new application but you will have to do it only once.
Use this command in command prompt:
adb install -r yourapplicationname.apk
It is because of the Low Internal Memory size. Uninstall applications that are not useful. Try it after that. If u don't want to uninstall any application then you can install your APK file directly to the SD Card. Because of that your problem is solve.
I give you the hint how to Install APK on SD Card..
First create Emulator with SD Card Support and SD Card size - 1024 MiB.
After that U can Install your apk file on to sd card directly using command prompt.
Type below code in command prompt to install:
adb install -s name.apk
You need to change the package name of your application otherwise it is not possible to install two applications with same package name and different keys.

Viewing private files created by an android app

I have an xml file being written by an app that is set to MODE_PRIVATE, but I now want to read that file outside of the phone, for debugging purposes. In Eclipse, I can access other files made by the app and copy them to my computer, but I can't even see this private file. Merely changing the file to MODE_WORLD_READABLE file doesn't seem to help. I think the file is being stored on an internal "SD card" that can not be removed from the phone, but there are also two other folders in the File Explorer that are either empty or inaccessible: asec and secure.
Does anyone know how the file can be accessed?
If your app is installed in debug mode, you can get your private files on a device without rooting.
Go to [android-sdk]/platform-tools folder and run adb shell.
run-as com.example.yourapp
cp -r /data/data/com.example.yourapp /sdcard/
(Where com.example.yourapp is the package name of your application.)
After executing the steps above, the private folder of your application is copied into the root of your sdcard storage, under your package name, where you have permission to download and view them.
Note 1: If you don't need to download them, then instead of step 3, you can use unix commands to navigate around and list files and folders.
Note 2: Starting from Android Studio 2.0, you'll find more files in the cache and files/instant-run folder, related to the Instant Run and the GPU Debugger features, placed there by the IDE.
You will need to connect the phone and do some magic to let your sdk work with it (I think put it in debugging mode?). Go to where you unzipped the android sdk:
C:\android-sdk_r10-windows\android-sdk-windows\platform-tools>adb shell
#cd data/data/com.yourpackage.yourapp/files
#ls
You should see your file listed. You may need to run "ls data/data" if you're not sure what the fully-qualified name of your app is. From here if the file is small and you just want to see what's inside it you can run:
#cat yourfilename.xml
Alternatively:
#exit
C:\android-sdk_r10-windows\android-sdk-windows\platform-tools>adb pull /data/data/com.yourpackage.yourapp/files/yourfile.xml
Note: I have only tried this on the emulator, I don't know how to use adb with a physical phone.
You need to root your phone to see Context.MODE_PRIVATE files
It ends up being stored in data//files I believe but you need root permission to see them
So either root your phone or wait until you finished debugging and then add Context.MODE_PRIVATE
If Eclipse is used, there is one more option:
DDMS Perspective > File Explorer tab > data/data/com.yourpackage.yourapp/files
where you can pull/push/delete files.
Another option is to have a command in the app that dumps the private files. This only works if you don't want to edit the files, but has the added bonus that you don't have to strip it out before it goes to production, because the user can't break anything with it. Well, as long as the files don't contain sensitive information. But, really, if they do, you're doing something wrong. As #user1778055 said, a user can root their phone to access it.

Categories

Resources