I'm walking through a small example to hit https web services. It requires building a keystore and placing the resulting bks file into the /res/raw directory. Simple enough. However, I can not access the file through R.raw...
I placed the file into the /res/raw directory, refreshed my project in Eclipse, navigated to the /res/raw directory in Eclipse and confirmed that it showed up in the project. However, when I type R.raw. in my file, the resulting list of possible filenames is empty.
I've tried cleaning and rebuilding, but the project still has no clue what R.raw.mycert is.
What am I doing wrong?
The answer to this question can be found here:
R.raw.anything cannot be resolved
When Eclispe is starting to behave weirdly, my last trick is to remove the project from the workspace and add it again... Try also to quit and restart eclispe
Good luck!
Try this -- find your EclipseWorkspace.
There should be a 'res' directory. So open it.
You will likely NOT find a 'raw' subdirectory.
So create a 'raw' directory, and drop your file into it. (I suppose these have to follow the rwx permissions under Linux that the others follow. I did this in Windows.)
Close the project, then open it again. See if 'res.raw.yourfile' shows up in the package explorer (it should).
I also discovered that 'R.raw.yourfile' is now noticed, and you should find an entry in 'gen/*/R.java' for this.
I think there's a bug in the gen compiler, or maybe Eclipse configuration. gen seems to be very picky about just what kind of resource it wants to look at, and is also doing some name mashing. For example, R.string.xxx finds a string by name xxx, even though the string resources are under 'res.values.string.xml'. So there's clearly a lot of magic going on, maybe special kludges known only to the gods in Mountain View.
Why this fix broke it loose I have no idea.
Related
So, my problem is that their is a space in one of my directory leading to appdata and on android studio i need to give him this path but he can't find it because he think that after the space their is nothing else, as you can see with the screen at "ce pc", can i do something to change the name of this directory or maybe change the sdk location ?
I already tried to modify the name with regedit and it was a really bad idea hopefully i did a backup before doing it.
With all my research i didn't found any way to move the sdk directory so maybe you can help
I want to move Installed AndroidStudio from C: disk to another.
I've successfully(by standard way) .android folder, sdk folder(with it's environment variable) and installation path. However, I cant handle these ones:
c:\users\user\.AndroidStudio2.2
c:\users\user\.gradle
when I move these folders to d:\myfolder and changing every occurrence of c:\users\user\.AndroidStudio2.2 to d:\myfolder\.AndroidStudio2.2 (with TextCrawler), and changing .gradle location in AndroidStudio, it doesnt help.
In C:\user\user there is still created (upon running AStudio) .AndroidStudio2.2 folder. And running Emulator causes errors, because it cant find anything options in C:\users......
plus, I have uncommented and set the path values (in installation/bin/idea.properties) to d:\myfolder, but still no help.
Having dome something similar in the past, I find that moving drives on most software applications is still a big pain. However, I found that creating symlinks was helpful, as the software will "think" it's accessing the files at a location, but in reality they are stored in another.
I successfully did this in the past with Visual Studio and the concept is pretty much the same with Android Studio. You need to create a symlink as follows:
mklink /J "d:\myfolder\.AndroidStudio2.2" "c:\users\user\.AndroidStudio2.2"
Now when Android studio read or write the contents in c:\users\user\.AndroidStudio2.2, it will be in reality going to your d drive, which provided that it's accessible by the c drive, should make it all work.
You should be able to do that with the other folders as well. The benefit of doing it this way is that you're not constrained to the path the file is stored, which means that if you change computers or decide to store everything on the c drive again, you can just remove the symlink.
Hope this helps you.
I have just made an application that uses a SQLite database, and I finally managed to export the database file onto the computer without having to root the Android device. The method I am using is mostly from code I found on various Stack Overflow question/answers. I am basically saving the database file to the public Download folder.
When I look on the Android device using a file explorer, I can see the correct SQLite file in the correct folder (Download folder). However, when I open up the same folder in Windows Explorer from my PC, I can not see the file in the exact same folder.
Now here is the strangest part: When I copy or move the file (using the Android device), even if I am copying and/or moving the file TO THE EXACT SAME SPOT, as soon as I have finished doing this the file instantly becomes visible in Windows Explorer.
I do not want the user to have to do this manually every time, so does anyone know of any way to make sure that the file will be visible right away? Thank you in advance!
Things I have tried so far:
Show hidden files and folders in Windows Explorer
Programmatically moving the file to a new folder within the application itself (the move to the new folder works, but the file still remains invisible in Windows Explorer until manually moving/copying the file again)
Searched StackOverflow for similar issues and have been unsuccessful.
And if anyone wants to see some of my code, let me know and I will post it, but I am thinking that this is less to do with my code and more to do with Android/Windows interaction. And this is where I got my move folder function from: stackoverflow.com/questions/4178168/how-to-programmatically-move-copy-and-delete-files-and-directories-on-sd
Thank you!
I had a similar issue and it was not visible in Windows because I hadn't given it a file extension.
Give it a file extension if you haven't already.
It seems to be very easy, but don't know why I can't use Assets.open method without getting FileNotFound exception.
I followed an example in xamrain.com
http://docs.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_6_-_using_android_assets/
and still not getting it to work.
I added a txt file under Assets folder
Set the Build Action to "AndroidAsset"
I tried with also setting COpy to Output Diretory to "Always Copy" and "Do not Copy".
No matter what the combination, I always get FileNotFound exception.
Looked like many of fellow developers also see the problem and I don't see the answer that I can try.
Appreciate if someone could shed a light on this easy subject.
Thanks in advance
Firstly, without seeing your code, it's impossible to see any mistakes you may have missed. It's easy to miss a filename issue, or other problem that may not be so obvious.
Speculatively though, I will try to give you some pointers.
The 'Copy to Output Directory' setting is not important for Android resources. The build action of AndroidAsset will ensure that the file is included in the app package, allowing you to load it using Assets.Open().
To confirm this, have a look for the compiled .apk file in the bin/debug or bin/release folder. The .apk file is simply an archive, so you can open it up with with winrar, or 7-zip, or rename it to .zip and windows will open it.
If the file is in the assets folder, then there is probably a problem with your code. You should post it in your question. If the file isn't there, try cleaning your project, or deleting the bin folder to force a fresh build and re-package.
Check properties of the file. I had to set "Build Action" to AndroidAsset and after this it works fine.
I got this problem before, and I finally found a image file in my directory assets/ was named by Chinese characters so the images in the assets are not loaded in correct way.
I guess you should check out the filenames if it was badly coded.
You should try name files only in lowercase. Sometimes android convert names to lower even file contains uppercase.
I was looking for a way to add some such folder in my Android Project that do no get compiled up to my apk file.
Why I need it :-
We need to maintain proper documentation for project (that actually
everybody needs to ;) nothing new),
but I find it very irritating to look out for that documentation
folder again and again.
.
I am open for any way i can make dcocumentain folder easily one
click accessible (I am already doing it thru taskbar sortcut. ) But
I want it to get the ease of version control thru Eclipse likewise we
do it for our project
IDE :- Eclipse
I got a way myself :-
I had an idea that if I create a folder in my application project with
some anonymous name that actually android has not listed in its
directories ("I am talking about the default one like "res", "src",
"anim"......)
Then either it should "raise an error" or should "ignore" it while compiling to form apk file
luckily it ignores any such folder. now i can put all the documentation in my project.
NOTE:-
My answer empirically driven
I had tested it by creating a "Docs" folder and then copied 1 GB of
random data (includes almost all type of files we came across from
multimedia to zipped ones).
Then I build the apk and the size of the apk was in-effective of all
this..
but when i copied the same data to assets it was showing a huge change
in size of my apk file..
Consider using Javadoc in addition or, if possible, instead of any other documentation.