Eclipse cannot recognize the linked 'res' folder for an android project - android

I tried to reuse the "drawable" folder of the first android project. For the second project "drawable" file, I just created a linked folder to "res" of my first project and expected any change on the "drawable" of first project would reflected on the second one. But the system does not recognize the virtual folder, how can I fix it without copying and pasting?
Error appears on the lines like: android:background="#drawable/button_deepskyblue"

Related

Android studio removes my file/folder in packages (in android package) automatically, how to prevent?

I create a folder in android package path (in this path: app\build\generated\source\r\debug\android\ ) named "print" to put my files.
Application works well but after a while it removes automatically and must create and copy my files again.
I unchecked "Optimize imports on fly" in Settings>Editor>General>AutoImport but again deleted my file (same as checked).
I don't understand why it deletes that file and folder, You have any solution?
You have to put the file inside the src folder ,not the build folder.
screenShot showing where the file should be
You are putting your folder inside an Android generated folder. That will get regenerated every time you rebuild. You will have to put your files elsewhere. If they are media files, put them in a resource folder. Otherwise, assets works too.

Images and Directories not showing in Drawables directory

I imported a number of image assets, and I copied the assets into the project by copy/paste them into the project via Finder on my Mac. I've done a clean/rebuild on the project, and the files & directories showed for a moment, but then they disappeared. Now I can't get the files and the directories to show up. The files are clearly in the directory and project, but they don't show in Android Studio. They are labeled drawable-hdpi, drawable-mdpi, and so on. Here is an image of the files:
Here is my Android Studio:
Switch in project view will show you all folders for example drawable.hdpi and so on check all these folder for all images.
It turns out that I added my images to the drawables directory rather than the resources directory! Ugh...

Assets Folder Not Getting Added To Android Studio Project and APK

I'm trying to add an Assets folder to my Android Project in Android Studio 2.1.2. I right click on the project and choose New -> Folder -> Assets Folder. In the project pane on the left, it doesn't show up when Android is selected. If I switch to Project Files, it does appear, however it looks like a normal directory, rather than looking like a resource directory. I then tried adding files to it (jpgs), both through Android Studio and through the file explorer (all file names are lowercase with no special characters). If you unzip the apk that gets created though, it doesn't contain an Assets directory or the added files. Also sometimes the assets directory will disappear from the project files pane, although it's still in explorer.
What step am I missing to get to the Assets directory properly added to my project?
Note: this is for a LibGdx project that expects image files to be there.
Finally got it. Appears to be a bug in Android Studio, but to make it work, in the Project pane, go to Android view and (this next part is critical) right click on the res folder and go to New->Folder->Assets folder. You might want to click change folder location to be sure it's going into the main folder (mine was) just to be on the safe side.
You must right click on the res folder. That was my issue. If you right click on the module or anywhere else, even though the folder will get created in the proper spot, Android Studio and gradle won't treat it as a resource directory and just ignores it.
Be sure to create folder in app/src/main/ and call it assets.
For me in Android Studio 3.6.2, the assets folder wasn't showing up in the "Android" view, no matter where I tried to create it, after trying the other suggestions here. In the "Project" view it showed up in app/assets as a plain folder. I then drag-and-dropped it to src/main/assets and it automatically changed its icon to the same icon as the res folder, and after this it is now also showing up in the "Android" view, so I guess Android Studio is picking it up correctly now, and it appears to be a bug in Android Studio.
If you created a folder in your res directory and named it "assets" and now as "Nullqwerty" mentioned you could not able to solve your problem and you face to the duplication error, just go to the project tab (or press Alt + 1) and in the view mode, change it from "Android" to "Project", then expand all folders in your project to find assets folder in your src\main\res directory (or in src\main path) and right-click on your "assets" folder (if you created it before by adding a "Directory" and named it assets), then change your view mode from "Project" to "Android", again, and right-click on "res" directory->New->Folder->Assets Folder. Then click on "Finish" button to see the assets folder on your main directory as you want. That's it ;)

Android Studio newly created folders not showing

I am using Android Studio 2.1.1 (currently the most updated stable version).
I created new directory inside 'res' by name "values-21"
and it don't shows up.
But if I go to the physical location of 'res' on the hard drive I can see that its exist.
and of course I checked using both Android and Project Files structure but either way its not showing it.
I wanted to check where is the problem so I created another directory by name "menu", and the last one was shown.
just to be sure I tried to create the same directory again ("values-21") but Android studio didn't allowed it because this directory allready exist's.
any ideas how to fix it?
Update - the solution is to create new directory using the "Android resource Directory" option and not by "Directory" option.
all you values xml files stored in values, values-21, values-mdpi or other physical folder in AndroidStudio displayed in one res/values folder.
It will not show until you copy a XML file into values-21, android studio consider all values folders to be of same family and it shows only one folder and the files with post script of the family in which it lies.
copy some layout file from resource directory and through windows explorer paste in that the folder that you have created i.e values-21 and now come back to android studio and check the folder should be there.
Happy coding

How to tell Eclipse that folder was moved

I have moved (the content of) the src folder of my Android project to src/main/java because I want to use gradle. So far no problem.
But then I moved the res folder to src/main/res because I want to use a different res folder in src/debug/res for my debug builds. Now Eclipse gives me that error:
ERROR: resource directory '/.../MyProject/res' does not exist
How can I tell Eclipse that the folder was moved? I already moved the folder back and then again to the new location using right-click -> Refactor -> Move. So Eclipse should know where the res folder is.

Categories

Resources