I have problem with ASSETS folder in android. I put folders and files in ASSETS, and for some folders/files I got FileNotFoundException. Then I printed all folder/file names from ASSETS folder by code, and I saw that not all folders/files are packaged into APK. Why is that happening? All files and folders have names without special characters, example: "Prevoz tereta i lica vozilima/Prevoz tereta i lica vozilima.json"? For some files/folders it works, and for some it doesn't. Does anyone know how to solve this problem? Thanks in advance!
I think I found solution for my problem. Files that needed to be in ASSETS folder were created on my desktop. I created ASSETS folder in Android Studio, but when I was putting files from desktop to assets I didn't put them via Android Studio but Windows Explorer instead. I found location of assets folder and pasted files there, so I think that Android Studio didn't index some of them. Now I created 4-5 files and folders via Android Studio (right click on assets folder -> new -> file/directory), and every one of them is packaged and working all right. So I think that was the problem and the solution. I will have to create every file and folder by hand in Android Studio, then just put data in those empty files afterwards. Thank you all for help/suggestions. I'm glad that I found the solution, even if it's stupid.
I'll make this an accepted answer tomorrow, because stackoverflow doesn't allow me to do so until tomorrow.
You have to somehow refresh your project.
If you are using Android Studio goto File>Synchronize or press 'CTRL + ALT + y'.
Make sure your assets folder is in src/main directory of your project.
file-invalidate and restart
tools-android-sync project with gradle files
READ IF USING IONIC AND TRANSFERRING FILES ATOM/OTHER IDE TO ANDROIDSTUDIO
There's an IDE interface issue.
What worked for me: removing and readding android as such:
ionic cordova platform remove android
(you might have to manually remove android folder from platforms)
ionic cordova platform add android
Then you can move on with generating a release file and then generating a signed apk in android studio etc.
Related
I am using eclipse juno -adt tool Eclipse Platform Version: 4.2.1.
i lost all projects from eclipse project explorer .they doesnt have single line of code. all projects in work space folder have 0kb data(user/workplace). is it possible to restore the complete projects from .metdata or work space runtime.
cd ~/Documents/workspace/.metalog/.plugins
rm -rf org.eclipse.core.resources
i have tried above commands but rm is not recognized .how can i setup path for eclipse.. please help me out..
I don't think that you can get it back, ask experts if you still don't get you may try this, there is 50% chance that you may get .java files atleast.
1) Download recuva
2) Open recuva and select All contents.
3) Locate the path to your workspace.
4) "Deep scan" that may take hours, when you get all the deleted data back, extract .java, .xml files from them.
5) Create a new workspace and add those files, and you can reprogram Manifist files manually. (If you are working on android)
Try manually separating metadata for each package from the metadata folder in your workspace. Once you do that put the corresponding metadata and packages to a separate folder and then in your eclipse choose workspace window select the folder which you created for individual packages. It'll work. All the best.
I have just experienced the same problem. The entire project displays all the files but they are all 0 bytes. Most recent bit bucket sync is not very recent. After cursing and kicking things, I had some luck with recuva. Since it is an android project, I have the latest apk I had installed in my phone yesterday as I was doing the test, dex2Jar and JD-GUI helped a little her, but there are still mountains of code I will never get back.
I'm using Eclipse (4.2.1 Juno) on Windows 7 for my Android 2.2 project. I have several PNG resources in my drawable folders, and I'm finding that if I edit my PNG files (Paint/Photoshop etc) Eclipse doesn't recognise the file has changed and the ADT graphical layout designer still displays the old version of the image. I've tried refreshing the project folders list, tried doing a Project->Clean but neither has any affect. The only way I've found of getting Eclipse to recognise the new image version is to exit completely and restart which is a pain.
Is there some setting I can use to tell Eclipse not to 'cache' the images and always read the latest version off disk?
Try in Eclipse Project -> Clean then select your project. This will delete your R.java file and will generate new one.
That is a common problem of Eclipse that it doesn't recognize external changes for files in the workspace. The only thing I have found out to remedy this problem a little (apart from refreshing like crazy), are the refresh settings in external tools configurations. That is, if you run for example an Ant build, you can tell eclipse to refresh the workspace or specific resources afterwards. I don't know of any automatic way to do this though.
you should try saving all the unsaved resources and files after adding images ,than try out again.try cleaning both options with cleaning your single working project and with cleaning all projects.
I don't know of an automatic setting, but I have found a relatively simple manual action that seems effective. I was having the same trouble as you; now the following procedure seems to work consistently for me, with Eclipse Juno 4.2.1.
Click on the "res" folder to select it, then press F5 to refresh. Also make sure your PNG file timestamps have been touched.
Resources cached in bin\res folder.
Create script which delete folder bin\res with all content.
Add this script as external tool in builder list.
Set position in builder list - after CDT builder. Second position in list. If no CDT builder - set it first.
Enjoy.
Just updated SDK and ADT, and running a test project here now, I can't get it to build.
Android AAPT problem "invalid resource directory name", and the problem is desktop.ini which is placed in all of the res folders. It just gets put back if I delete it. The desktop.ini's also prevent r.java from being built as it depends on a clean res folder.
My workspace is on a Google Drive directory if that matters. Thanks!
I use google drive and I come across the same problem, please use windows folder browser search to search desktop.ini in the whole project folder, so that you can select all and delete them all at once. Don' t try to delete one by one in the folder. (I have 1000+ desktop.ini in the whole project)
I had an Android project in eclipse, I then duplicated the project changed some of the code and updated the images, in windows explorer and eclipse the images are updated but when I run the app it uses the images from the original project, not the copy but I want the two projects to use their own images.
Any Ideas? have I missed something I needed to update in the new project?
In the "Build" folder you may see temporary files to build the application. Eclipse does not always correctly updates them because attributes of files may be violated.
If "project cleaning" has not helped you may delete the "Build" folder from the project folder.
This is a dumb newbie question, but one that is driving me nuts.
I have an Android project being developed on Eclipse with two source files. Eclipse for some reason decided I didn't need one of the files and removed it from the project (i.e., I pushed the wrong key at the wrong moment). Now I only have one source file in my project. The lost source file is still there in the directory, but Eclipse just doesn't recognize it as part of the project. How do I get it back?
MY first suggestion is press F5 on the source folder.
Second suggestion, right click the project folder->Properties->Java Build Path -> Source - expand ".../src" and ensure your source file is not under the Excluded option.
Try dragging the file out of your folder onto the desktop, and then drag it from the desktop into your source folder in eclipse. I've had a handful of different situations where this was necessary.