Installing application on SD-card in Android sdk 2.2 - android

I am facing this problem and finding solution for this issue since last 2 weeks.
Right now i have developed an android application for the client perpose, whose size is 54 MB, from which 52 MB of only Images/Photos.
[Edit: I need to keep images in "drawable" folder ]
So i want to install it in sd-card on Android SDK 2.2 for that i have already set android:installLocation="preferExternal" in the AndroidManifest.xml file. I have created 256MB sd-card while creating an avd , heap size - 192 , ram size - 192
but it still showing me an error:
[2010-08-27 17:58:28 - demo_test]
Failed to upload demo_test.apk on
device 'emulator-5554'
[2010-08-27
17:58:28 - demo_test]
java.io.IOException: Unable to upload
file: No space left on device
[2010-08-27 17:58:28 - demo_test]
Launch canceled!
Edit:
Is this memory related issue of internal memory or external memory?
What i have to do to run application and still test with emulator?
How do i install application in sd-card in Android sdk 2.2?

Is the sd-cards size really 256MB? I sometimes forget the suffix and end up with.. something very small.
You can also always raise the sizes to like 512, 256,266 and try again to be certain it's something else.
Also, Logcat output would be nice too.
Edit: As it seems, you cant just "install" the app on the SDcard even if you have 30+Gigabyte free on it. Installation depends also on the internal memory of the phone even in 2.2.
Example: Nexus one has 512mb internal memory. The android os takes the needed ram for the camera, gpu, kernel etc leaving a user with only around 190MB app space (which will be even lower due to apps already installed etc).
HTC Hero on the other hand has only 288mb internal memory, leaving it with a very small "app size ram".
Depending on the phone, 90mb app will install to SDcard on nexus one, but won't on Hero due to memory limitations.
The reason you are getting that error is that, after the android os takes the needed ram out of those 192MB, the "app size ram" is not enough to hold that 50+mb application.
I thought that installLocation would install directly to SD, but that is not the case.
Vidar Vestnes blog confirmed what I described above by performing a test with different app sizes on his HTC Desire..

A better approach would be to put your resources in their own directory on the SD card. Then your app can load them when it needs.

I suggest you try increasing the internal memory available (screenshot says 43MB), in case the .apk is being copied there first before it is installed to the SD card by the OS.

Assuming you need the images on your device instead of on the cloud, the easiest way would be to make the app connect to a server of yours and download a zip containing all the images on its first run. Until devices get a larger "app ram size" this might be your only solution.

You can use the following:
adb shell pm setInstallLocation 2
from the android-sdk/tools directory to force the emulator to install to your sd card, whatever its size -- preferably large enough to hold your app(s), obviously.
If you want to go back to the default installation location (phone app memory), do:
adb shell pm setInstallLocation 0
You can also use these adb commands on your phone / tablet.
Once you have set up the emulator to install to the sd card, you can then go into Settings --> Applications --> Manage Applications, choose the app you want to be on the sd card, and the "Move to SD Card" button will no longer be grayed out.

you can check if the sd card is really mounted and enough space is available by the running
adb shell df
command in the android-sdk/tools directory
it shows you which partitions are currently mounted, how big they are and how much free space is available

Related

Xamarin Emulator - Remove Previous Deployments

I'm developing a medium sized Xamarin application, with intensive data processing. I can do about 10 deployments before the internal disk space is to full. I did some searching and came across this one question - same issue but I'm looking for an actual solution.
"There is not enough storage space on the device to store package" when starting Android emulator
It's not feasible for me to wipe the device when this error occurs due to the nature of the application. Is there away to wipe out the previous deployments but retain the application data and not uninstall the application or wipe the emulator?
Thanks!
Start the emulator via the cmd-line and use the -partition-size (in MB) to increase the size of the "internal storage" (the default size that Xamarin starts it with is 512mb). This will be reflected with the Storage section of Setting on the emulator.
i.e.
emulator.exe -avd Pixel_XL_API_26_PlayStore.avd -partition-size 4096
Note: To avoid the partition being reset, do not change to a value less than what you were using, increasing the size is always safe(?)....
re: https://developer.android.com/studio/run/emulator-commandline

How to take entirely android os as a image file?

1-I have rooted my tablet(android 5.1.1).
2-I have installed some apps as System app...
3-I need to take a backup of my entire android os, including data_user and system apps, all together.
is it possible to take an image of android os including every things?
At first, use mount or cat /proc/mtd command to identify your block devices. And then copy all image to file:
cat /dev/mtd/mtd16ro > /sdcard/my_system_image.bin
/dev/mtd/mtd16ro - system partition at my tablet (your may be different)
/sdcard/my_system_image.bin - your image at your sdcard

How to turn a portable SD card into internal storage via ADB command?

Android 6.0 Marshmallow’s introduces Adoptable Storage, a feature that allows use a SD Card as internal storage.
Is it possible to activate adoptable storage via ADB shell commands?
I managed succesfully perform this operation on my LG K8 LTE. I want to notice there are "500 xxx Unknown disk" errors problems, and give solution to avoid this. Solution is very simple.
Proper steps in ADB would be:
adb shell
sm list-disks
// HERE YOU GET YOUR DISK ID, SOMETHING LIKE "disk:179,64" - REMEMBER THOSE NUMBERS
sm set-force-adoptable true
// IN NEXT LINE, SIMPLY PUT THOSE NUMBERS AFTER "disk:" AND ALSO AFTER WORD "mixed" TYPE PERCENTAGE OF SPACE LEFT AS EXTERNAL, SO IN MY CASE:
sm partition disk:179,64 mixed 60
// IT TAKES TIME. BE PATIENT. WITH THIS LINE I TRANSFORMED WHOLE EXTERNAL SD INTO 40% OF INTERNAL AND 60% OF EXTERNAL
sm set-force-adoptable false
BANG! That's it! Now go to storage and usb, there click on internal part of SD and expand options, click on "use as internal" or something like that, last option, (I cannot see what was that because I already clicked it and everything works) apps are finally going on SD with OBB files! ;)
Have a good day!
I have done somewhat extensive research on this question online. I can tell you the steps, and they seem to work for everyone but me. Try them and let me know if they work for you.
Back Up your SD card, as it will be wiped.
If you don't already have it, download and install Java SE Development kit. The website is www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. I used version 8u101 for Windows x64.
If you don't already have it, download Android SDK Manager. The website is developer.android.com/studio/index.html. Scroll almost to the bottom where it has "Get just the command line tools" and select android-sdk_r24.4.1-windows.zip for Windows. When it downloads, extract all to a location where you want to keep the folder.
Open the Android SDK folder and run the SDK Manager. (If it fails to run, see question 14504325 in stackoverflow). Follow the instructions on www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/ to get it up-and-running.
When you have the command prompt open per the how-to-geek website instructions, enter "adb shell"
Then enter "sm list-disks". This will return the name of your microSD card. The instructions I was following showed a disk labeled 179:160, but my computer showed the disks as 179,32. This is where I'm stuck.
Finally, enter "sm partition disk:179:160 private", where the numbers are the name of your disk from step 6, if you want to adopt your whole SD card as internal storage. Otherwise, enter "sm partition disk:179:160 mixed 25" where the last number is the percent of the card's space used for external storage. I have not been able to get this to work.
See http://www.modaco.com/news/android/heres-how-to-configure-adoptable-storage-on-your-s7-s7-edge-r1632/ for the original instructions.
P.S. I tried this on a Samsung Galaxy On5, so that might explain why it hasn't worked.
This has now been disabled on (at least) some Samsung tablets.
I have a galaxy tablet that has been running with a huge sd card formatted as internal storage.
I purchased another more recently and on this adb format command did not work (it just immediately returned to the command prompt).
I have had to do a factory reset on the older machine and now find that it too will not allow the SD card to be formatted as internal memory - it behaves just as the newer one does.
My guess would be that Google have updated android to 'respect' the settings of the suppliers UI.
This has (of course) completely messed up my system, as the backup/restore was based on main memory of over 100GB, not the 16GB the device actually has.

"Insufficient Storage Available" even there is lot of free space in device memory

The total space of my app is 10 MB, and after installation it will take less than 20 MB. In Galaxy Note I, while updating my app, it's saying "Insufficient Storage Available", where there is 214 MB of free space in device memory (internal). It happens even trying to download a new app.
I searched long for the solution, and a perfect reason for the cause of this problem, but I can't find it. How do I fix this problem?
This is the result of the 'adb shell df' in my another device which has the same problem. It has 35 MB free space:
/dev: 115788K total, 0K used, 115788K available (block size 4096)
/mnt/asec: 115788K total, 0K used, 115788K available (block size 4096)
/system: 179840K total, 168376K used, 11464K available (block size 4096)
/data: 201856K total, 168524K used, 33332K available (block size 4096)
/cache: 108544K total, 1284K used, 107260K available (block size 4096)
/cdrom: 8960K total, 8632K used, 328K available (block size 4096)
/tmp: 2048K total, 28K used, 2020K available (block size 4096)
/pds: 1536K total, 1320K used, 216K available (block size 4096)
/mnt/sdcard: 1928992K total, 1014496K used, 914496K available (block size 32768)
/mnt/secure/asec: Permission denied
Here's a very simple solution that works on my Samsung Galaxy S II and Note 1; I have no idea about other models:
Open the phone app and switch to keypad.
Dial *#9900#
On the screen that appears, click on the button labelled "Delete dumpstate/logcat".
I've restored about one GB of system space this way.
At first I tried Berislav Lopac's answer, but I got Connection problem or invalid MMI code. when I tried to dial *#9900#. I was using CyanogenMod on the phone, and I believe phones with custom ROMs don't use the stock dialer, so they lack the SysDump functionality.
Basically, Delete dumpstate/logcat in SysDump clears out the log files in /data/log. But you can also do this manually without SysDump. (This is assuming your phone has been rooted, which will be the case if your phone is running CyanogenMod or any other non-stock ROM.)
Make sure Superuser and Terminal Emulator apps are installed. (They come with most custom ROMs.)
Run Terminal Emulator
Type in su, hit return.
This will bring up a Superuser prompt. Grant access. (You will have to wait three seconds before you can click "Allow".)
Change current directory by typing in cd /data/log, followed by return.
MAKE SURE you are in the data/log directory by typing in pwd, followed by return. It should print out the present working directory you are in: /data/log. It is very important to make sure you are in the right directory as the next step removes all files in whatever working directory you presently are in.
Remove all the files in the directory by typing in rm *, followed by return.
Close the terminal window or app, or type in exit to leave the su session.
I deleted roughly 1,500 1 MB files like this and fixed my "Insufficient Storage Available" problem.
As with the other posters, I own a Galaxy S II, so it seems to be a problem with that model.
If anyone knows of the permanent solution to stop the log files building up, please let me know.
NOTE: Some file managers will falsely list /data/log to be empty as they are running unprivileged and hence lack the permissions to view the files inside.
The memory may be in reserve by the OS to be used for running what you normally run (kind of like a swap file). You may be able to squeeze in another app or two by
Trying to install them right after a restart, or
By force closing some apps that are running (but that second option may not be a good idea -- see the first link),
But the only very good fix might be to
Repartition your SD card so that apps can be installed directly to it (see the second link).
Take a look at forum post It was bound to happen: low memory warning!.
The important part is:
The OS knows how much memory it needs to run the apps you already have. This is a perfect example.
Now you may be able to "fool" the OS by force closing some apps that
are sitting in RAM. This will increase your "bucket" of memory which
may let you install an app, but remember if you do these types of
things you will only cause issues down the road.. lagg, error
messages, etc. (because you are fooling the OS in thinking you have
given it additional memory which in fact you did.. you only force
closed).
Another good explanation of what is happening is in forum post Low Internal Memory.
The important part is:
The reason why your internal space is filling up is 3-fold. First,
when an app is "moved" to the SD card, it isn't completely moved. Only
portions of it actually go. Second, the Dalvik cache of the app is
still stored on the internal memory (which takes up a substantial
amount of space). Three, the data for apps and all your system
settings are stored in the internal memory (yes, some apps use the
SD card for portions of their data, but every app has data stored on
the internal memory).
And the thread includes suggestions on what partitioning you can do to your SD card to allow 'moar apps'!
The package manager (“installer”) has a design problem: it can’t distinguish between a bunch of possible errors and regularly comes up with the “insufficient storage” excuse.
The first steps are done: identify it’s an install problem (1.) and not related to storage shortage (2.)
It happens on the console (pm install file.apk), with Google Play, other markets and manual GUI-install (for example, “clicking” on a downloaded APK file); it is not a download issue, ...
Packages end up entirely on the /data partition -or- mostly on the SD card (and a little on /data). – Both places show enough space as indicated by the original poster (33 MB and >900 MB respectively) for the <20 MB package. –And– the /data partition has more than 10% free (33 MB is more than 10% of 200 MB).
Surprisingly most answers don’t take this into account...
In reality, the /data partition needs a cleanup from residues from previous installs.
Identify the common name of the problematic package (for example, com.abc.def)
Uninstall the package (for example, pm uninstall com.abc.def)
Check what’s left of it in data (for example, find /data -name 'com.abc.def*')
Delete that stuff
The installer chokes on those, returning with the wrong reason. – The interesting part is: if the package gets installed on the SD card (forced or by other means) some (all?) leftovers on /data don’t hurt... which leads to the false belief that it is indeed a space problem (more space on the SD card...)!
The Stack Overflow question where I got half of this from is Solution to INSTALL_FAILED_INSUFFICIENT_STORAGE error on Android.
The first thing to do is to check the details of the error message. For this you could use the LogCat App.
For me the problem was an error like
Cannot rename native library directory /data/app-lib/vmdl-... to /data/app-lib/com.xyz
The solution was to activate the common sense function in my brain and look for the com.xyz folder in the app-lib folder with ES-Explorer. I recognized that this folder was already there. So removing it solved the renaming problem and the apps can now install properly.
The same problem was coming for my phone and this resolved the problem:
Go to Application Manager/ Apps from Settings.
Select Google Play Services.
Click Uninstall Updates button to the right of the Force Stop button.
Once the updates are uninstalled, you should see Disable button
which means you are done.
You will see lots of free space available now.
I also had this issue while installating an app after I had uninstalled that. I resolved downloading Lucky Patcher and then click on menu - troubleshooting - remove fixes and backups (insufficient storage available). Please notice you need your device to be rooted.
I have an un-rooted Nexus 4 (which has only internal storage, no SD card) and was getting this error with larger apps updating. Smaller apps would update fine.
I discovered that it was because I have recently signed up to the Play Music All Access service and had pinned several albums.
These are downloaded to the hidden /data partition and it was this that had run out of space (I assume)
I unpinned a couple of albums and now have no problems installing apps.
1. Restart the phone and then re-install the application!
I was also getting the same problem Insufficient Storage Available on my device, but I restarted my device, and it worked fine!
PS.:
2. Install application on external storage
For this, set Storage Location with the following command
adb shell pm set-Install-Location 2 // 2 for external storage ([SD card][1])
adb shell pm set-Install-Location 1 // 2 for internal storage
adb shell pm set-Install-Location 0 // for auto
I had this problem even with plenty of internal memory and SD memory. This solution is only for apps that won't update, or have previously been installed on the phone and won't install.
It appears that in some cases there are directories left over from a previous install and the new app cannot remove or overwrite these.
The first thing to do is try uninstalling the app first and try again. In my case this worked for a couple of apps.
For the next step you need root access on your phone:
With a file manager go to /data/app-lib and find the directory (or directories) associated with the app. For example for kindle it is com.amazon.kindle. Delete these. Also go to /data/data and do the same.
Then goto play store and re-install the app. This worked for all apps in my case.
I had the same problem, and it was solved by using App Cache Cleaner.
(HT: acejavelin#Android Forums)
I tried several of the suggested solutions, but none of them worked for me. After some research I stumbled upon a hint to move some apps from /data/app to /system/app. That freed up enough space to install new apps and update existing ones.
I can recommend the free utility SystemCleanup for moving the apps.
This is the easiest thing to do. Go to settings
look for storage or memory touch it and look for cached data. touch it
and clear your data from there. SIMPLE!!!
Does the app necessarily have to be installed in internal storage? If you are not running any service, you could try installing it on the external storage. This can be done by adding the following code in your manifest:
manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal".....
This usually works on Android 2.2 and higher in most of the cases. Be sure that your app will work properly if it is installed on the external storage. You'll get a good idea on what kind of apps can be installed on external storage in App Install Location.
When it comes to areal device, the behavior of devices seem different to a different group of devices.
Some of the strange collection of the opinion I heard form different people is:
Restart your device after unplugging
Remove some apps from device and free at-least 100 MB
Try to install your app from the command line, ./adb install ~Application_path
Move your application to SD card storage or make it default in SD card in the Android manifest file, android:installLocation="preferExternal"
You got a lot of memory acquiring stuff in the Raw folder which installs a copy in phone memory while instating an APK file and the device doesn't have enough memory to load them
Root your device and install some good ROM which help to letting the device know about its remaining memory.
I hope one of them is relevant to you! ;)
Most of the space you have available is reserved by the OS. The best and easy fix is to move your apps to external storage. This will free up a lot of space for you.
Some apps need to reboot to completely install. Android just says it has insufficient memory for some reason - it should say it needs reboot to complete the installation. Try it - it will install completely automatically when you reboot.
I resolved this issue for myself. Though, the internal and SD memory was showing a lot of free space. It was an issue with phone memory, which was almost full.
Hence, I moved many of my apps from the phone memory to internal iemory, to free up the phone memory: Settings -> Storage -> Apps (under the internal storage section) -> Internal tab
Here are the ones which are not checked and that are occupying the space on the phone memory.
Click on the Apps (one by one)
Click on the button: 'Move to Internal Storage'.
Once you free up a considerable amount of space on the phone memory this way, the error should not come.
After uninstalling a few apps I'm able to install the new one...
I think OS calculates the total memory required to run all apps. If it doesn't fit then it says "in sufficient memory".
I had the same issue on Galaxy S4 (i9505) on stock ROM (4.2.2 ME2). I had free space like this: 473 MB on /data, 344 MB on /system, 2 GB on /cache. I was getting the free spate error on any download from Play Store (small app, 2.5 MB), I checked LogCat, it said "Cancel download of ABC because insufficient free space".
Then I freed up some space on /data, 600 MB free, and now it's working fine, apps download and install ;). So it seems like this ROM needs a little more free space to work OK...
Clearing the Google Play cache memory will also help you... Go to the app information page of Google Play and clear it.
I did not find a free solution that worked, but I found a solution: I used the non-free version of Titanium backup, clicked on the context button and chose to check the memory occupied by apps. Find the download app, and you will see that it has a certain amount of space allocated to its cache. Clear data is the option that you want.
I got the same error message in case the package name was too long (>128 chars). Just using a shorter name fixed the issue.
I had more than 2 GB internal space and yet I was not able to install / update applications either from Google Play or manually.
Whatever may be the reason, wiping the cache partition solved my purpose.
Steps:
Recovery -> Wipe cache partition -> Reboot system now
If you have root, delete all of the folders on the path:
/data/app-lib/
And then restart your device.
I had this issue many times, and this fix worked for me each time. It even has an XDA thread.
I write all folders, because if there is a problem with one app, there is a good chance you have this issue with other apps too. Plus, it's annoying to find just the folders of the problematic app/s .
Go to Settings, Apps, All and uninstall Google Play Store.
This will replace by the old version and then you can download without the "Insufficient Storage ERROR"
It works for me
I kept having this problem, and I cleaned up the Dalvik cache using Titanium Backup. You'll need to have your phone rooted. As soon as I did that I was able to update Swiftkey and Beautiful Widgets.

Installing a large size apk application on Android phone

I have an application which is of size 130MB. when i try to install its displaying insufficient memory error. but i have around 170MB left in available space in internal memory. How can i Install this app? The size of the app is large because it contains many media files. In Motorolla droid its getting installed. but on Nexus One its giving this error.
I would not package the media files in the app itself. It would be better to put the media files on a server and have the app download the media files to the sdcard. This is a common thing for Android apps to do. If you install that large of an app, that means you have much less room to install other apps. If you have users other than yourself, they will despise that the app is so large.
Another option, is to install Froyo on the Nexus One and alter the app so it can be installed on the sd card.

Categories

Resources