I have an app, and stupid me decided to change a resource in the file from being filename.bmp to being a png, and released an upgrade with this, I removed the .bmp from the APK and added the PNG, and placed it on the marketplace.
Now, I have some users who are not able to run the app, it is failing with a file not found on the line referencing the resource name in the VIEW XML description.
Now, it is only some users, not all.. but its still infuriating, when a suer upgrades, are the old APK files removed? IE is the old .BMP file gone? I have been unable to fully replicated the problem on my equipment, but I am working off the theory that the .BMP and the .PNG file are now both in the resource/drawable directory and the XML inflate is just getting confused.
You will need to rename the files BMP and PNG to completely different names. This could cause confusion though.
I would recommend using one file type for all applications. And it may be that some user's are not experiencing the issue is because of screen density. Make sure all of the resources use the same naming convention and are availible for each screen size.
Rename the file to something completely different.
Have you tried cleaning your project?
Related
Maybe the title is a little bit confusing , but I will try to explain
I have an app with a lot of audio files keep in raw resource folder like this
so those audio files are big , and language specific. I'm using app bundle , and its force me to have this base raw folder.
So now every apk generated for specific language has both base and language specific raws, and my apk is twice as big as it should be
Is there a way to prevent adding raw-s from base folder to final apk ?
regards
Wojtek
EDIT: I found cheat solution :/ I don't like it but it seems to work.
I have added a resConfig for all suported languages and in base raw folder I've added a dummy empty files 1 KB. Tested on different languages and it works, but it is not the kind of solution I'm feeling fine with :/
You can use language targeted assets. It's not documented as not explicitly supported but it should work.
Instead of putting your files at the root of your APK, put them under:
assets/audio#lang_fr/a1.mp3
assets/audio#lang_fr/a2.mp3
...
assets/audio#lang_es/a1.mp3
assets/audio#lang_es/a2.mp3
...
assets/audio/a1.mp3
assets/audio/a2.mp3
Since it's not documented, it's possible that the behaviour changes without notice though, but I thought I'd mention it in case you want to try it out.
I am getting duplicate files in my source code:
This happens quite often with Android Studio and it happens will all types of files, not just gradle files. It typically happens when I checkout a new branch or swith branches.
What is causing this and how can I prevent it?
As a note, this question was originally posted with image files, thus the image answers. However, this is not limited to image files and I understand why there are multiple image files for different screen densities. I have updated to reflect that there are other files being duplicated.
Do you have a Mac, and is your project stored in your "Documents" directory?
Filenames that include " 2" are generated by iCloud when it can't reconcile two versions of a file. E.g. if you have two computers, and both of them share their "Documents" directories via iCloud, and a file were to be changed simultaneously on both computers, iCloud would wind up creating e.g. a build 2.gradle file.
I found this was happening to me, even though I'm only using one computer to do my work. I suspect that Android Studio may be interacting with iCloud directly, not realizing that it's working on files that are already backed up on iCloud. (See Android Studio generating hundreds of duplicate " 2" files).
I seem to have fixed it by moving my project directory out of Documents. At any rate, I haven't had a problem since I did that.
(Credit to Mike M. for noticing the similarity between our problems.)
Since different devices support different screen densities, all non-vector image drawables should have an image asset for each type of density. So, from a development standpoint, you're using the same Drawable but the app will use the correct image size based on the screen density of the device the app is installed in. I suggest you take a look at this article for more information.
It's ok. Follow the every folder. Folder name is different according to possible phone size Different phone size is different, that’s why they support different size images.
I need to maintain some duplication into my Android App (in Android Studio) by having some resources in "res/values-iw/" and copy the exact content of that folder to a folder named "res/values-he/". The reason is explained here.
I saw that gradle has a copy function but I have no idea with what task it would be better to wire it (and I guess as doFirst)?
Also, is it possible to not have that copied folder in my original res folder as I don't really need to see it all the time beside the original one, for instance in /build/ folder for build time? That way the copied folder will always be an up-to-date copy of the original "/res/values-iw" folder.
Thanks in advance,
Alex
Instead of copying, you might want to set up symlinks instead. The symlinks should hopefully be preserved in source control, and it's better than having the build system muck around with duplicating source files. For large resources, though, like drawables, consider using aliases which should hopefully prevent duplication that will bloat your APK.
Instead of copying, would alias resources be better? http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources
They let you create references to a single resource in different contexts instead of copying them around. It should save space in your binary, too, which would be a big plus.
This might seems silly but seriously I don't even know why it reacts that way. I am using eclipse JUNO, and I just trying out simple program enables me to put an image inside the layout after my real program said it have the error.
The project shows the error icon but when looking all in the subs-project like the class, layout everything, it is crystal clear. You can see it like the picture above.
I have making an android project before I am updating the adt and stuff. Before this, all I do just put any picture(s) I want in any folder drawable. I believe this is the right step and I know I do the same thing in here but it have issue with it. I even search on the basic tutorial how to put the image and it did the same why I did.
Does anyone knows what had happen here?
Android dont allow image names to contain capital letters in drawable folder change the name to contain only small letters
Capital letters , and some symbols are not allowed to be in the name of the png file , update the name of the png file , . make it in smaall letters
As per user inazaruk's answer, Hence the reason for not using special characters inside file names, as they can no be used in Java names.
As for capital letters, I guess that's to avoid one little problem in Windows vs. Linux environment. That's because Linux thinks that Icon.png and icon.png are different files, and Windows thinks that Icon.png and icon.png is the same file. So anyone using Linux can create application that is not compilable on Windows.
So, change your Humanpng with human Also don't use the extension png as picture name.
Just check your Problems tab in Eclipse. You can find it from
Window > Show View > Problems.
There you can find the error description.
I have an App that was working perfectly, then I released an update and now suddenly some users cannot inflate the main view.. it is dying on inflation of the XML on line 28 with a nested exception of
Resources$NotFoundException: File From Drawable resource ID #0X10200004
on line 28 of the Binary XML inflate which references #drawable/pl
the pl.bmp file is in the res/drawable directory and is not corrupted, so the resource exists.
The only thing I can see that seems odd is the R.java file that is generated references this drawable with an id of #0X7F0200009, and there are no files reference id's that start with #0X1.... at all.. so I am not sure how or why these particular users are even getting that ID as the reference for the drawable. There is an #0X7f0200004 in the R.Java drawable class but it is a completely different graphic.
This is certainly happening with some folks who have upgraded, and I suspect with some folks who have purchased new. I am unable to replicate this behvior on any device I have access to, or on the emulator, but it is clearly happening for some people.
Does anyone have any ideas? Is the upgrade not picking up the right R.java file? How is that even possible? At first I thought it might be a file name collision as earlier releases had p as a bmp and release where this started I changed it to a png, but I made sure to delete pl.bmp before build, and subsequently renamed it to pl, so there is no way even if the old p files both .bmp and .png were somehow on the device it would not possibly collide, but this doesn't seem to be the problem.
Any help would be greately appreciated.
Thanks in advance.
Well this amazingly appears to be something related to an OS Drawable reference tied to the android.R.id.empty.
Don't ask me why this worked fine, and then suddenly started not working for some users after I change my XML definition, but I have removed the reference to this and am now using my own transparent graphic instead and everything appears to be working fine.