Add project library error when close project properties? - java

I work with eclipse and I would like to use from external project library some class. Every time I open project properties add this external project I get following problem. There is no problems with another project libraries. This additional project has ticked "Is Library".

I think the best way to import an Android library is :
import your library projects to your workspace
right click your main project and properties
close to the top, choose Android
Then click add from the library section at the bottom

Related

Build path problems with sdk

I just downloaded the Android SDK and the plugin but when I try to create a project it automatically makes a library for the support and my project that I created has errors. Here is what I mean:
This is after I clean up the projects [Project -> Clean]
Additionally, R does not work (even when I import it) :
This is all with a clean project. I would appreciate it if you could help me.
Note: I know there are similar questions out there, but I could not get it working.
I think I need to import the appcompat package again, but I do not know where to locate it.
The error the container "Android Dependencies references non existing library" probably means your build path isn't pointing to any jar file. I recommend checking your build path:
Right click and choose 'build path'
Click on 'Android'. Make sure app_compact appears under the library target. If it does not click 'add' under library to add it.

How do I share classes between two Android projects in Eclipse?

I have 2 Android projects in Eclipse. Now the both need to share one class. As soon as I add a Project to the buildpath of the other, the folder is added but always marked with a red cross. How can I resolve this? Thanks for any help.
You can use the feature of isLibrary project.
1)Create a new Android project.
2)Add all the classes that you want to share them between multiple projects.
3)Right click on this project and select properties.
4)From Android section in left menu mark the project as isLibrary project checkbox.
5)Right click on all the project you want to share the class with them and select properties.
6)From Android section in left menu click on the button Add and select the library project.
7)Use the class normally as if it is in your project and add its imports.
I hope it helps.
Note: The previous steps is for Eclipse
Mark project(that contains the class to be use in another) as library by right clicking the project and then properties.
You don't have to do it by means of a library project, you could use a common source folder.
If you are developing in Eclipse then the trick is to have a common source folder (common to both projects) Make this folder outside of both projects and in the build properties/source, click 'link source' and browse to the location of the common source. (You can call it any name you want) Do this in both projects and it will appear in both projects' Package Explorer and when you change it in one project, the other will get updated too.
It will have to have the same package name in both projects.

Import source java project in Android project

Is it possible to import an existing Java project which is in my workspace, in an Android project which is also in my workspace? The Java project doesn't use stuff that is incompatible with Android. I could do it using a .JAR, but since I'm modifying the Java project a lot, I would like to import the whole source code and change it once in a while. Is it possible? Thanks
This is somewhat of a hack, but worked for my project:
Add both Android project and plain Java project to workspace
Go to properties for Android project -> Java Build Path -> Source
Click Link Source, in "Folder name", make sure to select the root directory of the plain Java project's src tree
Use a descriptive name for "Linked folder location", like "java_project_src".
Press Finish and compile
This setup will compile the plain-java code as Dalvik bytecode. In my case, I had pure java code with very limited dependencies, but wanted to share the pure java code with non-Android projects, instead of separately maintaining these files in every project.
I think you are talking about referencing other projects into the current project, if this is the case then you can do this by Right click on project, properties->Project Reference.
You can link another projects to your current project. Right click on your main project, choose Build Path -> Configure Build Path... In the dialog choose the Projects tab, then click Add.. button. Now choose the project you want to link and click OK. You'll now be able to use this project's sources inside your main project. Hope this helps.

Problem with linking to other project in Android Eclipse environment

I am developing an Android application as an Eclipse project that uses classes from another Eclipse Android project I already have. When I originally imported it (New Project > Android Project > From Existing Source), it had a bunch of errors, but when I did Project > Properties > Java Build Path and went to the projects tab and added the other project, the errors went away. Unfortunately, when I ran the application, I got the following error in DDMS:
java.lang.NoClassDefFoundError: [package name].Config
[stack trace]
Is there something I'm supposed to add to the manifest telling it to look at the other package? If so, where would that be added?
Thanks in advance
Found the answer. It turns out that if I add the compiled class files into a JAR file using Eclipse's export command and then link to external jars in the Java Build Path, it works without having to change the Android Manifest at all.
Try using the File -> Import...
Then go to "Existing projects into Workspace" and choose the root directory of the project.
The one where are the src,res... folders
Your second project should be a library. Open project properties, select the Android tab and check "is library".
In your main project, open its properties, select Android tab also and click on Add in the library section and add your second project.

Problem in compiling java project in Netbeans

I have a problem now :
When I want to compile my project in Netbeans IDE I had this message error :
Problem: The project uses a class library called "toplink", but this class library was not found.
Solution: Click Resolve to open the Library Manager and create a new class library called "toplink".
In fact I didn't change anything and it works fine before?
What's the problem?
It seems that you have to import the library itself.
On the left pane in your Netbeans editor, you should have a series of panes. One of these is called the Projects pane. If you click on it, you should be able to see the files and packages which make up the project you are editing as nodes. One of these nodes, at the very end is called "Libraries". Right click on this node and select "Add Library". From there, you should be able to browse and locate the library.
I believe libraries are defined for the NetBeans installation rather than for the project. You can import a library into a project which would make it available on other NetBeans installations. Perhaps you are on a different computer or a new installation of NetBeans?

Categories

Resources