How to create a linked folder in Eclipse Android? - android

I have imported a project test1 which contains two weird linked folders. (at least for me they are weird :)
They look like this but I can't see any content, one can't open them.
Now I would like to write my own project and need to create these two folders but I do not have any idea how I do this.
When I go on the first linked folder of the imported project i see:
Path: /ImportedProject/org_taptwo_android_widget_viewflow_src
Location: _android_org_taptwo_android_widget_viewflow_7cfa4d63/src
I get many errors if I do not have these two linked folders. Can anybody help and tell me how to create these in my project?
I tried copy paste, but that did not work
I also tried to link source in the Java Build Path -> Source but that links the source folder and shows all the files and is somehow different from what I need.
Many thanks!

You can copy paste "Linked Folders".
(I can't figure out how to create them, so I just copied an existing one)

Related

Using android library project, with multiple src / res folders?

Sorry for what is probably a rather basic question, but I can't find the answer...
I downloaded a project from github, and I'm having trouble setting it up. I have virtually nill experience using code repositories. The project is is flagged as an android library project, and has two sets of source folders and resource folders buried in sub directories. Each src folder is dependent on its own resource folder.
You can see the project layout in the pic below.
Android gives me error that there are no "src" or "res" folders in the main directory. I tried using "build path > use as source folder" options to make android recognize them, but this leads to errors about not being able to find the resource folders.
How am I suppose to set this up?
I have used that library before. the problem you are facing is due to wrongly importing the whole repository as 1 project.
it is actually 2 separate projects:
two-way-gridview. this is the library project. you should import this subfolder on its' own.
sample. this is a sample project with examples how to use two-way-grid correctly.
you need to import both separately for it to work.

Are user-defined directory names allowed in an Android Eclipse project

I think I may know the answer to this question already, but I just wanna be 100% sure. Anyways, I am writing an Android app using Eclipse 4.2 ("Juno"). I want to create my SQLite database by using external files and reading/parsing these files by my code. Hence, I created my own directory called /database and placed it in my project's root directory. Then, Eclipse starts complaining, reports a problem and says:
Invalid recourse directory name.
I even tried placing my database directory in the existing /res directory, but that caused the same Eclipse problem. Just want to confirm what my initial thoughts are: Is it not allowed for me to define my own directories in the project and bundle it in with my release?
If so, then I guess I'll have to follow along with what was posted in this stackoverflow question.
put it in /assets not in /res and it should work.
You should be able to create arbitrary directories in the root of your Android project, however your application won't be able to access these files. This is useful for development purposes like storing test data, documentation, or jar files. However, you cannot create non-standard directories in places like gen and res.

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.

Eclipse Import Custom Class from /src

Hey I'm having a pretty basic problem importing classes into my Eclipse based Android app. I have included the class directory into the /src directory where I figured the classes would be easily included, but Eclipse is saying it "cannot resolve the classes".
One thing I noticed is that the project folder that I included and the subfolders are just regular folder and not package folder icons. Is that a problem? If so, how do I change them to packages? This is an external git repo, so I'd rather not do anything beyond just including them in my project.
Here are some pics of how I set up the project to help:
The Activity where the error is:
Here is the package structure in the project, and the package called "android-utils" where the files I'm trying to import live:
Here is how I'm importing the files:
Btw, these classes are just some utils and I'll be improving and adding to them during the development process.
Let me know if you need any in more info to help me get these files imported the right way. Thanks!
Did you try dragging the .java files from Windows Explorer directly onto the package in Eclipse you want to put the new classes into? It should then ask to copy or link to files.
As your folder contains only java files Add them as Jar File in your Buildpath project, and your problem will be solved.
Also your jar file you can put it under the /libs folder
see this link to lean how you create jar file

Combining packages from different projects into a single project in eclipse

As part of the Android application I am developing in eclipse, I need to combine two packages from different projects into a single project. I tried copying the files in the package of the second project under the src folder of the first folder and copied other files required for second package into the res folder of the first project.
But the auto-generated Java files i.e R.java doesn't get updated on copying. I tried right clicking on the project and clicking on Android Tools -> Fix Project Properties. But nothing changed.
I would rather add a second source directory through a linked folder.
(Especially since they now support relative path (3.5), as the following picture illustrates (3.6 only)
alt text http://img411.imageshack.us/img411/1299/dynamicpathvariables.png)
Another solution is simply to add the second project in the "Project dependencies" of the first.
alt text http://img24.imageshack.us/img24/9511/eclipsebuildpath.png
I ran into difficulties with VonC's method producing force-close noclassdeffounderror at run-time since referencing the external project doesn't make the class available run-time. Perhaps I was not doing it correctly, but I found a different solution to share:
Put both projects that you need to combine into the same workspace and open both. Set one project as a library, and reference the library in the other "main" project, as shown in:
http://developer.android.com/guide/developing/projects/projects-eclipse.html
Don't forget to declare any applications you use from the library project in the main project's manifest.
You shouldn't have to resort to importing or cross-referencing projects.
As far as I am aware, the R.java file is generated from the XML files in res.
Specifically, it is created based on the "id" in layouts and "name" in the strings.xml file. (There are probably other things that do it, but this is what I know).
Perhaps, when copying your files, your ids are not formatted with the "+" that encourages the values to be created if they do not already exist.
For example, a TextView in a layout would contain:
<TextView
android:id="#+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
The plus there is crucial to new creation of values.
It may also help to put a basic edit into an xml file, save it, then undo the edit and save again. The saving may trigger the Eclipse plug-in to regenerate the R.java file.

Categories

Resources