Can't add Resources/layout folder in shared Xamarin project - android

I'm working on shared project and needed to add Resources/layout folder but this leads me to error about this folder alredy existing.
In my project Resources folder only have Drawable and values subfolders. In actual file system here is also some alternative folders for drawables. But here is no layout folder.
How can I solve this problem?
Maybe it's fine to use different folder name? I can add layout_ folder without errors.

Problem was solved by removing code refering to not existing yet Resource.Layout and rebuilding solution.
Can't tell for sure what's actually solved a problem.

Related

Drawable is not recognised for Android project in Visual Studio

I am working on a Xamarin Android project in Visual Studio. I am trying to add a xml file in drawable folder, it gets added but no resource id is being generated for it. Same thing is happening with image files.
It was working before as, I have added many images and drawables but now its not working.
So please suggest what can I do to add and use them.
Thanks!
I am trying to add a xml file in drawable folder, it gets added but no resource id is being generated for it.
Check if the resource id has been generated in Resource.designer.cs. If it has not been generated, usually clean and rebuilding the project will generate it again , unless there is a syntax error somewhere.
be sure that images doesn't have '-' symbol. For example home-button.png remove it or use '_' instead.

R.java file doesn't allow creation of new folder in the project

I have been trying to create a folder manually to keep all the styling xml files inside my android project using eclipse in windows 7. As soon as I create a xml file inside that new folder and save the xml file. My R.java goes missing. I understand that R.java is not taking in the manual changes to the project. I believe there is a way we can make changes to the project by manually adding folders and reflecting the changes to the R.java file accordingly.
So can anyone please help me out as to what do I have to do to allow manual changes in my project as described above?
the only way you can create a styles xml file, is inside a values folder, so you can't assemble all the styles files inside one folder, android will not recognize it, thus, not allowing what you are trying to do
here is a link to follow when creating a folder,
http://developer.android.com/guide/topics/resources/providing-resources.html
check this part within Table 1. Resource directories supported inside project res/ directory.
Styling XML files should go someone in your RES folder, typically some flavor of "values" (like just "values" or "values-hdpi", etc.)
Putting them somewhere else can cause errors, usually they just can't be used but also could cause Eclipse to not be able to build the R.java file correctly.

Android: Source path not being included

In my project I have added some folders that I want included in my project for source files. But no matter what I do, the source never gets recognized. I tried refreshing, clean up, restarting but nothing works. Here is the project's source folder:
I want the folders integration/android added. This is how it is showing up in Eclipse:
And here is what my build configuration looks like:
I could be wrong, but it looks like you have added them as a folder, but not actually added the folder to your project.
The folder should show up in your src folder in the solution explorer window under your other package.
Try creating the package name in your project, then move all the src files into it.
And when its in the src folder, in its correct package, you dont need to include any extra build paths.
(You can have multiple packages in a single application)
Importing someone elses project that is over 2 years old is almost always problematic. I found the easiest solution just to create a fresh project and add the files manually from the old project.

Where should I put the ical4j.properties file in an Eclipse Android project?

I have an Eclipse Android project that works alright on its own.
I have included an external library called ical4j (I've copied the required jar files into my libs folder which have been automatically added into Android Dependencies by Eclipse) and I can use it just fine. Well, sort of. There is another issue that may or may not be related to this, but I'd rather open another question for that.
However, whenever I use ical4j, it keeps complaining that it cannot find the ical4j.properties file. I get the following error:
08-14 17:45:02.430: I/Configurator(17046): ical4j.properties not found.
Wchich is apparently caused by this line in ical4j's Configurator.java file:
CONFIG.load(Configurator.class.getResourceAsStream("/ical4j.properties"));
The ical4j Wiki shows the file should be located in the src folder. However this does not work.
I've tried placing the file in the following project folders: src, res, libs, assets, the Android root folder, bin, bin/res, and even within all of my packages inside the src folder. However nothing works. It simply does not see it.
So where should this file be?
The problem was, believe it or not, creating the CalendarBuilder object in a non-main thread.
CalendarBuilder from ical4j is not thread-safe, so it causes all sorts of issues.
You should put into folder:
"Projectname/target/classes/ical4j.properties" within file-explorer and not by the IDE.That works for me
In Eclipse Proton the solution is to put ical4j.properties into ProjectName/bin folder.

I changed a resource in Eclipse and the app displays the old resource

In my app, I decided to change a resource (a PNG file). So, I delete the old one and add the new one with the same name. However, when I run my app in both my phone and the emulator, I still see the old picture !!
I tried all these options:
Cleaning the project.
Refreshing the project folder.
Closing the project then opening it again.
Exiting Eclipse and launch it again.
Uninstalling the old version of the app from the phone before run it again.
For those who may ask about how I use this resource (PNG file), I assign a XML selector file as an ImageButton's drawable. My resource is referenced in that XML file.
Any ideas will be appreciated.
You should change the Modified Date of the file to later. I did it.
Use this http://www.nirsoft.net/utils/filedatech.html
Look through your project's folders for other png files. Many mobile platforms use pngcrush to optimize pngs for mobile, and it is caching them somewhere. When you replaced the file, the IDE didn't notice and hasn't recrushed the new file. The old files will be somewhere in either the workspace's folder, or less likely, Eclipse's application support folders.
Are you on Windows, Mac, or Linux?
Changing an image resource file won't cause Eclipse to build a new version. Try modifying a source file by adding a new line, deleting the line, then saving the file. Eclipse should then rebuild your app when you launch it.
You just need to clean the project before rebuilding it, this removes all previous states and should update resource files if you've changed them in anyway.
Eclipse has a bad habit of compiling all your code to a structure within it's .metadata directory. Not sure if this is the case for your mobile app though.
Try searching the .metadata directory for the original png and modifying/deleting it there. We've had the same issue with deploying to web servers previously and Eclipse not picking up the changes.
I solved it.
The trick was to choose a different name for my image, modify my xml selector file and re-build the project.
Thanks

Categories

Resources