java.io.IOException: No space left on device Android - java

We have application on android market, our users getting a lot from this error:
java.io.IOException: No space left on device
From what I found out so far, I know that they got enough space left on they external storage, and it's only happen on Android 2.x .
I had a small research in Linux file system, and I found out that beyond the space limitation there are limitation on number of files in each directory and the total number of files under root directory. But it looks like our app is not hitting any of those.
Have you ever run in two some thing like that?
Any ideas about what changed in Android (2.x) and how they fix it in Android (3+)?
Edit: this is not installation problem, but when trying to save downloaded files.

adding a loging-output of the absolute filepath, that caused the exception might help.
if the file beeing written was written to local memory file-system and not to sd-card-filesystem here is a possible solution:
java.io.IOException: No space left on device my mean that there is not enought memory left on the internal storage file system of the device.
You can try to install the app on the sd-card instead by setting an entry in the manifest-file:
<manifest ..... android:installLocation="preferExternal">
Edit
if an app is installed in internal memory it-s local files are stored in local memory, too.
if an app is installed on sd-cardit it-s local files are stored on sd-card, too.
so installing the app on sd-card might solve your problem.

I believe (if I'm not correct) that it could be having trouble opening a big file or any file that goes over the max of the eternal storage after all the space is used up. For example: My android didn't have any problems opening up until after I used all of the space on my device til the very last bit. Unless I upgrade or delete all of my fav songs and movies it won't work. Tested and tried it. But then again the error could be more flexible and mean something else as well... :D

Related

Picasso failure in Android Native Developing

I have an android application coded with Java in Android Studio.
I published my Restful Api to web server.
Whenever i open my android app, the pictures uploaded to the server can not be downloaded to the app via Picasso.
Moreover I can not access these pictures under App_Data folder. Any solutions?
I want to share that answer in case someone needs it.
The accessing problem to my pictures under the App_Data folder was caused by a missing virtual directory matching.
First i created a virtual directory pointing to my pictures folder under App_Data.
Second i tested whether i can access these pictures with chrome browser. if i typed the correct path with the new created virtual directory i can access via web browser.
But the key issue is that i can not access these files again from my app.
I found the reason by deep diving and analyzing.
The actual problem is that:
When i tried to access these files by my android app, Picasso assigns some mapping in its cache. which is under my android app folder.
Because of this cache, no matter i fixed the virtual directory issue Picasso can not access them. Picasso only checks it's cache and if there is a 404 error for that file it doesn't try one more time.
So at the and i completely uninstalled from the device and i installed it again. After that everything is fine!
Edit:clearing picasso cache also works. But it must be used on similar conditions, otherwise clearing picasso cache can affect load times as well as internet usage.

How do I create a directory at /0 on Android?

I'm having a problem with my users (Android). They delete the app, and their data is gone. They expect it not to be.
Browsing my phone, I see a lot of apps put a folder right off of /internal shared storage. I.E. I click on internal shared storage and there's a bunch of folders for various apps with data in them that doesn't go away if I uninstall the app.
This is what my customers want. This is what will stop them from writing me and accusing me of destroying their data.
How do I get a path to that folder, and what permission do I need to write there?
First off, deleting when the app is gone is how Android works. Anything else is a bug that you should expect to see fixed.
Secondly, you can't put anything right in / anymore. There was a time you could, but that's long since gone.
Third, have you looked into Android Data Backup? https://developer.android.com/guide/topics/data/backup This will work even on a new device, so its a better path forward anyway

Certain Phones delete SQLite DB

I've got an app created with Android Studio.
I'm using an SQLite database which gets downloaded and saved in phone's storage.
The problem is that in certain types of phones (Lenovo / Xiaomi to be exact) the sqlite file gets deleted after some time and the users have to re-download it.
The problem is appearing only on these 2 types of phones and also not all of them.
I can't replicate that on any of the phones I tried nor emulated ones within Android Studio.
There is no code that would delete the SQLite file and also I couldn't find anything in here or google about Lenovo/Xiaomi having similar problems like mine.
Any Ideas, would be appreciated.
I don't know about Lenovo, but Xiaomi phones have a "Clean up" feature that regularly (at least once a week, in my experience) asks the user to, well, let it clean up files. I don't know what it uses to decide if a file is obsolete or not, but it is a very aggressive cleaner (it wants to clean up cache files for apps that have just been used and are in constant use, for example). This is likely what is removing your downloaded files. You can check the location you're downloading them to, and see if changing that helps; or you could see if you can find any documentation on the file cleaner so you can find out how to stop it from flagging your DB as "rubbish".

Programmatically write to an android device

I would like to write a program in java that copies mp3 files from my PC, renames them so they sort correctly, and transfers them to the sdCard on my Android phone via USB. I assumed this would be a trivial task since I have already successfully written a similar program for transferring files to an external HDD, however I reached an immediate stumbling block. It seems that java (and indeed other desktop applications) cannot locate the device's file system even when given the exact path that windows explorer reports (This PC\SAMSUNG-SM-G900V\Card).
I've tried researching and the problem seems to have to do with the device being considered a Portable Device rather than a drive (maybe) but I have not found a concrete solution. An answer to the following question seems to suggest it is impossible but I find that hard to believe.
Can Android's internal memory be mapped to a drive letter on PC?
Does anyone know of a way to access Portable Device storage through java? If if it indeed impossible, can someone perhaps help me understand why it is possible through Windows Explorer but not through other programs.

Android - Server could not process your apk - Size limit?

I spent all day trying to figure out what is wrong with my apk. Tried ALL solutions from web, aapt revealed nothing, tried different signatures, packages, versions, browsers, OS. Manifest underwent all possible changes, yet I was getting same problem.
So I though OK, lets start from scratch, maybe google servers are down for some reason (wouldn't be the first time).
created new android application project, new package, just one activity
built, signed, uploaded, voila, OK, fine, removed apk from console
did this few times, it succeeded every time
the size of apk was few hundreds KB
as my original apk was around 25MB, I thought, hey, lets try increasing size of this testing one
so copied ~25MB worth of photos to drawable-hdpi
built, signed, uploaded and familiar message popped out again - 'Server could not process your apk'
tried several times, still same outcome
deleted photos, built, signed, uploaded, ok
added photos, no luck
So obviously problem is not in manifest or anything else, for some reason size matters (in this case anyway :)).
And yeah, when I deleted just 50% of photos, so apk was ~ 13MB, it sometimes worked, sometimes didn't.
Any explanation for this? Can you replicate? Have tried different browsers, operating systems, same everywhere ... I know there is a limit for apk size, but that's 50MB
Go figure ...
UPDATE: if you ever encounter same problem and you're sure your apk is fine, keep trying to upload. It worked after couple of consequent failed uploads, suddenly server COULD process, without ANY change to apk.
I don't know what's going on with your app and Google Play. Our largest APK file is just under 11MB and we've never had a problem.
Perhaps you can side-step the problem by packaging up the resources in an APK expansion file, as described here. The size limit for APK expansion files is 2GB, so there shouldn't be any size issues at all. According to this thread it can be set up to work pretty smoothly (transparently for the user).

Categories

Resources