I think the title is very clear. Sometimes I have some build errors, and in the Libraries tab of Java Build Path, I add/remove libraries, etc ... but when I delete the Android X.X "folder", I can't bring it back. What I do is to delete the project from the Workspace and Import it again as Existing Android Project.
Is there a way to add it directly without deleting-importing a project?
How does eclipse generate it? for what purpose? Why if missing eclipse doesn't show errors before building?
Please help me understand all these!
Yes you can do that without removing the project and importing it back.
Right Click your Project-> Java Build Path->Add Library->Android Classpath Container->Choose your Project->Ok
You will your Android X.X back.
Hope it helps.
When you delete your project click on the check box which says Delete projects content on disk and then import your project and to add library go to properties->java build path->order and export and check your library
Related
I'm fairly new to Intellij and Java and am unable to use libraries from one "module" in another. I am seeing red class names and getting "Cannot resolve symbol ..." errors all over the place:
The other modules are referenced in File | Project Structure all the other module's Paths are correct and include the *.classes I'm trying to use:
I have also tried a File | Invalidate Caches but am still having the same problems.
What do I need to do to fix this?
Listed below are steps which may fix the problem:
1.Invalidate and refresh the IntelliJ's caches
File Menu -> Invalidate Caches / Restart -> Invalidate and restart
2.Project SDK selection
Check project settings from File Menu -> Project Structure
Ensure an SDK is selected for the Project SDK. If is selected, click the 'New' button, select JDK and then select the correct path to the JDK e.g. /opt/java/jdk1.8 or c:\Java\Jdk1.8
3.Corrupt JDK
There may be a problem with your JDK installation, re-install JDK
4.Re-import the project
Close the project if it is open in IntelliJ
Delete the .idea folder in the project source code folder.
Start IntelliJ and Import the project.
You can choose any of them which will work for you.
I faced a similar problem for no reason, I think it was caused by IDE(android studio). I have tried all of the above solutions but not worked. Finally, in my own situation, I solved this problem by the following actions:
Delete your .idea folder in your local project.
Reopen this project and just let Gradle run itself.
It was worked for me. I hope that my experience will be useful for you.
You need to add your external libraries/classes under dependencies in order for IDEA to see them when doing code analysis/autocomplete.
You can go to "File->Project Structure"
From "Project Settings", Select "Project" tab and there make sure that "Project SDK" has proper JDK selection.
After you add dependencies to POM file, make it a habit to refresh POM by clicking on the 'Reimports maven projects' icon. Its the first icon in the maven tool window located to the right of the main intellij editor. Its a blue icon with 2 circular arrows. Clicking it ensures that the added dependencies are fully integrated into your project
Run it from the project's root folder.
$ mvn -U idea:idea
One more advise would be to make sure that you import the project properly. If it's a maven project, import pom.xml and if it's a gradle project, import gradle.build file to make sure that all the dependencies are downloaded correctly.
Just got this.
Just went there.
Invalidated the cache.
Seemed to work until I wrote further lines.
Then noticed that I was writing my code outside of the main() function.
Moved the ending curly bracket further and voila.
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.
I have this old java applet that i need to debug, yet i have some problems with import.
The import javax.media.* cannot be resolved.
The import com.sun.media.* cannot be resolved
After some research i tried adding this external libs to the project - with no success.
sun-jai_codec.jar from http://www.java2s.com/Code/Jar/s/Downloadsunjaicodecjar.htm
installed JMF2.1.1e and added the jmf.jar.
I had no luck with this... so im asking some one for a little help!
Just build the path of your project again. Right click on the project and then select build path--->configure build path--->java build path---->libraries
select all jars and then remove and then add all jars including the jars of your project.
then click ok. then go to order and export and click all the options. then click ok.
Sheez .. this was stupid.
Its a big MESS with this old classes/jar files.
It turned out i had the wrong ones...
Found them here (links in the answer):
Where can I download Jai and Jai-imageio?
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.
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.