Eclipse Galileo Java import cannot be resolve - java

i imported project that alredy works using SVN in eclipse , i needed to gain knowledge about that one, but unfortunetly i can't even build it. Whenever i build it i get multiple errors that are caused by
The import XXX.bl.* cannot be resolved
There are around 20 imports but only the ones from XXX.bl.* dont work. I will type you what i already tried to do:
Project -> Clean..
Adding XXX.bl in build path
Deleting and adding this imports
Changing to Java 1.6
Delete/Add JRE Library and adding Alternate JRE's
Ticking in Project Facets Java and Utility Mode (for no reason i read somewhere about it)
importing by clicking on "errored" viarable/class "import XXX.bl.*". Problem was solved but only until i Re-build/Clean project.
Closing projects, cleaning, open projects, cleaning
The weirdest thing is that when i type XXX.bl. and then click CTRL + Space it actually autofill this imports with correct names.
Im using JDK (Java EE 6 SDK Update 1 (with JDK 6 U23)).
I spent alot of time in order to search for a fix but nothing helpt so i figure out meaby if i create question here by myself and inform you what i already did you will be able to help me somehow.
Sorry for my pretty bad english, and thanks in advance!
codes are in 'sync', imports are in XXX.bl

Related

Visual Studio Code - Java - Import Errors and More

Just starting working on an existing project at work and wanted to use Visual Studio Code as my IDE (I have used it for a recent Rails project and loved it, so wanted to try with Java).
However, whenever I try to open one of the projects I receive a ton of different errors including:
When importing java.io, java.util, or anything similar, the error:
"The import of java.io (or java.util) cannot be resolved"
Existing classes have an error:
"The implicit super constructor is undefined for default constructor. Must define explicit constructor"
Other random "cannot resolve to a type" errors.
All of these seem to stem from some sort of setting error I have with VS Code but can seem to find what it is. I have already uninstalled and reinstalled the RedHat plug-in that enables the Java language for VS Code.
I have tried setting the java_home setting in the extension to the direct location of the install but that didn't work. Tried uninstalling and reinstalling java and that also didn't work.
My operating specs are as follows:
OS: macOS Sierra
VS Code version 1.15.1
JDK version 1.8.0.144
Any idea on what may be causing this? Do you think it may be an error in how I have VS Code set up or if it's an error (or rather incompatibility) with how the existing project is set up?
I ran into a similar issue. The solution was to remove everything from VS Code's workspace storage directory, which was located at $HOME/Library/Application Support/Code/User/workspaceStorage/.
I found this solution here: https://github.com/redhat-developer/vscode-java/wiki/Troubleshooting#clean-the-workspace-directory
Update: This can now be done from within VS Code as of Language Support for Java(TM) by Red Hat Version 0.33.0. Open the command palette and type "java clean" (see official description in link).
As already mentioned previously, you require to clean the project, but that is a bit difficult thing because every folder is a Guid, and you do not know which one to clear, thus requiring you to delete everything. Starting with 0.33.0 version of the plugin you can automatically do that from within the IDE as well, use CTRL + Shift + P and type, java clean, and IDE will show you the suggestion tip for, Java: Clean the Java language server workspace. Upon selection, agree and restart the IDE. It will clean the language server workspace for you.
Another approach can be, the Maven tools within the IDE. If you have this plugin installed, you can use the side bar and utilize the Maven project helper options to perform actions like, clean, install, and package etc. For example, here is the project I am having and the options this shows,
That can be used, graphically, to manage your Maven-based projects. Also, this would work with the Java Extension Pack, not sure yet as to how it would behave with other extensions.
For me: CMD + Shift + P
Then type "Java: Clean Java language Server Workspace"
Note: This will reload/restart vscode as well.
Update:
This appears to not fix it anymore for me. In my case I am using a gradle project, and needed to set the rootProject.name in the settings.gradle to be the same as the folder name that the project is in.
I faced this issue after creating a whole Java project in one computer and then trying to run it on another computer.
After doing everything said in the other answers, what really made VS Code compile was to open each single project java file in VS Code and save it (a simple Ctrl + S). Maybe there is a simpler way of doing it, but that is what worked for me and I hope this helps anyone stuck in this issue.
Press ctrl+shift+p
then search 'java clean' and click 'java: clean java language server workspace' then click restart IDE.
I found another simple trick at least to get rid of "cannot be resolved to a type" errors which were coming from older workspaces and wrong project files I guess?. I just ran an empty main(), with the body commented out, while still keeping my local package / import commands at the start - no errors. After commenting in again, the project compiled without errors. Perhaps this refreshing effect might also help in this context?
I had to clean this folder to get it working on Windows
%APPDATA%\code\Local Storage

Project in Eclipse break when I launch it today

This morning I just open Eclipse and find my project (which was working perfectly last time I worked on it and ran it) with tons of errors.
Error with package: "java.lang.Class cannot be resolved" same for java.lang.Object
I tried to add in library my JRE again so the error on package is fixed with this but now ALL other lines of my project (all my imports in each file, all my class , ...) contain an error so I don't understand 2 days ago my packages and imports were well imported into my project and everything goes well and no it's like all my project just break and now I don't find the solution to solve this ..
Please help
Hi all,
Finally I re-add a JDK and install all packages updated for eclipse and now I just have errors with my imports it seems eclipse doesn't find the imports I want I think it's because I start my project to the university and want to continue it at home on my own computer so do you know how should I add this imports and then eclipse can use them ? (on eclipse Juno 4.3)
Thanks for answers
Go to 'Configure Build Path' and add the required libraries

Why am I getting 'R cannot be resolved to a variable' on a previously working project(JAVA 8)?

I know that it has been asked thousands of times, but I really can't fix this at this momment. I'm trying to update an old project(already submitet to the play store). The only dependency was the v7 appcompact lybrary and so I added it to the new workspace and updated the existing project dep[endencie, but I'm still getting the strange R cannot be resolved to a variable error.
Here is what I'm doing and even if I'm 99% sure that it is what I have to do, it's not working.
Updating the project dependencie:
everything looks nice, but when I clean and rebuild the project, here is what happens:
and the problem is still there. I'm really going to start crying, because it was a working project, buta after switching to a new workspace and checking it out from my git repository, I can't get it working.
Do you have an idea what is going on? I know that I miss something small here, I know that it has been asked so many times, but I can't find an answer fitting on my case.
Remove library project android-support-v7-appcompact and add it again properly.
also check your package name in manifest file.
update SDK Build Tools on SDK Tools -> SDK Platform Tools, if not, please try it and clean & rebuild.
check imports to see any broken R.java imports. if there is "import android.R;" remove it.
check style and layout xmls to prevent any missing drawables or depreciates.
also see : R cannot be resolved - Android error
Just to tell my experience with this problem in a Java project with JDK8. In my case I was running the project in a Mac with Yosemite. Reading the specs. Android Studio and SDK, I've found that projects could be compiled up to Yosemite version.
I changed my environment variables to JDK7 and it worked!

The import cannot be resolved in eclipse [duplicate]

This question already has answers here:
Eclipse error: "The import XXX cannot be resolved"
(47 answers)
Closed 6 years ago.
Though I have all my source in proper packages.It couldn't find at the time of Building Project.Normally it shows links everything.But at the time of Build Project or Autobuild while directly running project.
The import ecnet.rd.config cannot be resolved
like it shows for all the internal imports.But external imports like imports from JAR files are working.
P.S :
My Eclipse latestly crashed but it was working well after that, Once again this kind of things are happening.
Please help to find the way to solve this.
In my experience, it is usual with Eclipse to have the build messed up. Make sure Build automatically is checked and Clean. If it doesn't work, restart Eclipse and do again.
Also as Tech Junkie comments below, try also Clean all projects.
I've seen this happen and another approach to take which is similar to m0skit0 solution (if you are using Eclipse) is to right click on the project, select maven, select update project, make sure clean projects and refresh workspace are checked, and hit ok.
After hours of struggle, creating a new Eclipse workspace, reimporting the projects and resetting up the same tomcat instance worked.
Probably the eclipse settings got messed up, and the deploy wasn't being done correctly anymore.

PhoneGap Android "Could not find *.apk" [duplicate]

I know this question has been asked before and I have seen a plethora of solutions out there, yet none seem to work for me. I was able to build my apk without issues until this error started cropping up. I have tried cleaning my project, removing it from the workspace and reimporting it, removing "Java Builder" from my Builders for the project, building the project manually, reordering my java build path. I have no visible compiler issues and no problems exist in my workspace.
I did experience this issue before and solved it once by removing the project form my workspace and re-importing it and another time I solved it by removing "Java Builder" from my java build path. None seem to work this time. I currently have most of the settings set back to default (i.e. java build is checked again).
I am running windows 7 (64 bit) and using jdk1.6.0_21 via Eclipse 3.6.
Any suggestions would be greatly appreciated as I have lost loads of development time troubleshooting this already.
[Update] My locale is English & I have tried removing the debug.keystore, United States as related to issue 834
Please follow these steps; this might help you out:
Right-click your app project and go to Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
If your app project relies on library projects which are in your workspace, those of course need to have the "Is Library" box checked.
deleting the R.Java file in /Gen folder did the trick for me
I tried all the above solutions. but it didn't work.
The solution was to restart eclipse !!!!!!!
hope this will help someone :)
In my case this problem started after eclipse updated the plugin with the v4.0 API release. I fixed it by going to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Note: if you eclipse gives you the Unknown Command 'crunch' error then follow this post
I've tried to gather the best of other peoples answers into a step by step list of things to try in order:
Check the project is not set as a library:
Go to Project->Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
Clean and rebuild the project - this should delete and recreate the entire gen folder, including the R.java file mentioned in some peoples answers
Check eclipse and all the Android plugins are up to date
Close the project, exit Eclipse, reopen eclipse, reopen the project.
Go to Java Build Path > Projects and check for any incorrect project dependencies
Go to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Check JAVA_HOME is set correctly. Follow the steps in this article
If you complete the above list, and still haven't solved the issue, please leave a comment, or if you find something else that works, feel free to edit the answer and add your thing in.
Delete the project from your workspace & import again.
This worked for me.
Can't believe similar issue has been there since 2008.
http://code.google.com/p/android/issues/detail?id=834.
i'm no expert, but eclipse on Windows, doing android apps, refuses to create the default.properties file (in the app root directory). I've just copied one from another app and it works fine. Simple contents, for Android 2.2 project it just says (ignoring comments):
target=android-8
fwiw
I was having the same issue as the OP except that all these suggestions did not work. I found a solution for me.
Make sure that "Skip packaging and dexing until export or launch." is selected.
Go to Window -> Preferences -> Android -> Build. Just make sure that option is selected and apply.
I know this does not make a lot of sense, but having it unselected was giving me this error and with it selected it goes away and the apk is installed.
I am using the auto generated ant build script from android and ONLY using it as my build process in eclipse. I am not using any other build methods.
I figured it out. I was referencing JavaSE-1.5 and using JDK 1.6. I changed it to use 1.6 and that appears to fix it.
Seems like through my research that is an overloaded error message that covers a lot of error cases.
I just fixed this by reselecting a default JRE for the execution environment (JRE6 for JavaSE-1.6 in my case). It got unchecked for some reason.
This fixed my problem. I kept getting the console error in eclipse "Could not find com_android_vending_licensing.apk" and even though it didnt seem to effect the way my app ran, it was annoying. So going into the com_android_vending_licensing project properties and unchecking the "is library" option, building the project to produce the needed apk and then going back into the com_android_vending_licensing project properties and re checking the "is library" check box fixed the problem.
Run Eclipse as "Administrator" and then import the project.
None of these things worked for me. I'm trying to access native code through the jni, first with NDK samples. What I found was the build won't run if jarlist.cache is not present in the project bin directory. If I copy one from another project to that location (may need to refresh to see the folder in Eclipse), build works every time.
Clean the project and it will do. Sometimes it happens unknowingly but keep trying to solve using diff methods.
I had somehow done a Run configuration as a Java application instead of a Android.
the problem for me was I was trying to use IBM RAD which appears to not work properly for this, I installed Eclipse and now have a different error but I should be able to get past it
On my machine (Windows7, 64bit) I could fix this by setting my execution environment to a 32bit variant of the jdk (I used 1.6.0_23). And I tried a lot of things before...
SHA1's answer did it for me: after updating to the latest sdk/adt, my project refused to build an apk; unchecking the option resolved the issue.
I don't know if the update checked this, or if it was checked before but the new adt screwed things up, but things work again now :)
In my case this worked :
Delete R.Java file in /Gen folder
+
Delete all "R.Android" imports that Eclipse added to some of my java classes !!!
and rebuild the project.
remove -- R.java -- Clean the project and run again.. this worked for me ..
Find the project's folder in your system, enter it's Properties via context menu and deselect "Read only" option. Worked in my case.
This seems to be the source of the problem in many cases, moreover some solutions up there base on copying/rewriting the files in the project what makes them non-read-only.
This is caused by JAVA_HOME not being set correctly. It can be easily resolved by following the steps in this article.
Mine was caused by this problem (incompatibility between ADT and SDK), and was fixed thus:
Eclipse > Help
Install New Software
Add 'https://dl-ssl.google.com/android/eclipse/' to 'Work With'
section and press enter
After developer tools appears on the list, check it and click Next
Restart eclipse once download is finished
I my case, I had to switch from API 21 to API 19, clean and build and everything was fine again. I am using a Mac and apparently API 21 is not fully supported on Yosemite.

Categories