I have eclipse and the ADT bundle correctly installed on my home PC, and tried to install it on my laptop so I can work on my projects on the go. However, I either didn't set the java paths correctly, or installed them in the wrong place, because I can't get a default project to load without errors.
I have correctly:
-Installed the ADT bundle and launched eclipse without errors
-Created a workspace
-Correctly Installed both the jre8 and jdk1.8.0_05 in the location C:\Program Files\Java
I am very new to Android development, and I feel like I was lucky to set up the Java dependencies correctly on my home PC, no such luck this time from what the error look like...
However, when I try to make a basic "Hello world" project, I immediately get the following error:
The container 'Android Dependencies' references non existing library 'C:\Users\userName\workspace\appcompat_v7_3\bin\appcompat_v7_3.jar'
I have tried adding the library, by checking build configurations, but I don't understand fully whats going on to correctly solve the problem. Here is my workspace:
And lastly, I tried checking the build configurations to see that the libraries are, in fact, missing. Or something like that. I am not sure if I should just try to reinstall java and the jdk.
Build configuration:
Anyway, I'm not sure what I deleted, misplaced, uninstalled, or didn't install, but if anyone could point me to a solution I would be very grateful. If anyone has any other questions on my setup I will try and be as thorough as possible. Thank you!
In my experience I have had issues like this if not running eclipse as Administrator. Make sure that you aren't being blocked here.
EDIT: Please note Chris Stratton's concers regarding running an IDE as Administrator, as seen in the comments below.
EDIT 2: In my more recent experience, I have noticed that if I installed the SDK by copying and pasting the contents of the downloaded, compressed, folder to a destination rather than extracting it first, I would be required to run as Administrator. If this is the case, delete the SDK that you copied out of the compressed folder and simply extract the contents of the downloaded compressed folder. I am running Windows 7 so it is likely that this applies to all Windows 7 and 8 OS's.
In another case, I have also seen issues like this if the JRE is installed second rather than first. In this case, a reinstall of the SDK is probably all that is required.
Related
I am having a lot of trouble for what should be an easy task. I'm trying to build a simple Java project (just Hello World) with Gradle for one of my courses before classes begin. I cloned the repository, downloaded all the relevant software, and tried gradle build on the command line. I get the error Supplied javaHome must be a valid directory. You supplied: C:\Program Files\AdoptOpenJDK\jre-8.0.282.8-hotspot. This file that shows up was a previous version that I had removed.
I tried reinstalling everything, and I also checked the JAVA_HOME environment variable, which is set to C:\Program Files\AdoptOpenJDK\jdk-15.0.2.7-hotspot\. I've also relaunched the terminal and rebooted my computer. I'm using Git Bash as my shell, if that's anything relevant. Any advice on how to change the supplied javaHome?
Here are some relevant screenshots:
Result of gradle build
Result of java -version
JAVA_HOME environment variable
My (very sketchy) solution is to make a copy of the existing jre15 folder I have and rename it to jre-8.0.282.8-hotspot. I can build and run my program now, but it just seems very sketch.
One year update: I asked my prof when classes started when he said this solution was actually pretty ok and would suffice for the semester.
I had a similar problem building a Java app on GitHub Actions. Once I upgraded from Java 11 to Java 16 I started to get the same error as you.
In my case it turned out to be a caching problem. I was caching two directories:
~/.gradle (on windows this should be something like C:\Users\username\.gradle)
project/.gradle (this one is the gradle directory that is local to my app project).
Invalidating the caches fixed the issue for me.
I had a similar problem after uninstalling a Java version with Gradle deamon running. Stopping the deamon fixed the issue for me:
gradle --stop
(Probably, a cross-platform equivalent of Miguel's solution)
Update gradle(gradle-wrapper.properties) version from Android Studio to the lates version
For me i just deleted the .gradle in my folder C:\Users\username\.gradle.
With Android Studio, dependencies are automatically reinstalled
I'm relatively new to programming. I recently installed Spring Tool Suite (the only option I found for the Mac install was for a 64bit version) for Mac on my system, and after installing I created a test project using a java main class to sys out "hello world" to the console. Everything was going swell until I tried to compile and run the program. The console spat back out at me "Error: Cannot find the main class TestApp" (Test App was the name of my main class). I checked it for errors, found none. I thought originally that the project was bad, so I deleted it and created a new project with a similar name. This project returned the same error.
I did some research and found that occasionally the .metadata file for a workspace can be corrupted, so I tried deleting that file, and reopening an STS workspace from the folder to regenerate it. This didn't work, so I tried creating a new file and starting a workspace there, then importing my test project into the new workspace. This also returned the same error.
So then I thought maybe my build path had been corrupted, so I checked and it was pointing to the correct files. I verified that the compiler is working and compiling the run, as the generated bin folder had a binary file in the project had a file in it. I tried I tried deleting the run config and starting over. Still no luck.
I tried project=> Clean, then re-running, then tried deleting the .bin file and re-running, which compiled and created a new binary file, but still returned the same error in the console.
I tried an uninstall and reinstall of STS, deleted all of the folders for my workspaces, and created new folders.
I tried fiddling around in the project libraries to see if any dependencies were missing, and found nothing.
I tried starting a SpringBoot app to see if maybe running Maven for dependencies would help somehow?
Someone suggested it may be an issue with my machine being older, and sure it's old, but it's fully updated, has an i5 processor, 16 gigs ram, and a full TB of storage. I would be really surprised if that were the issue.
These were all of the solutions that I could find, and I may have tried a few other things that I can't remember (I've been at it for the whole day now).
Does anyone have an idea what may be going on here? I'm at that point where punching the computer seems like a possibility. If it is my machine, I know that using the Eclipse IDE with an STS plugin may be more lightweight, but I've heard that the plugin is also kind of a pain to work with. Currently I've just uninstalled STS again, and may try installing again if I can find a new solution to try.
After some further research I came across a way to reconfigure JRE's. I'm not 100% sure of what I did to fix it, but after a full reinstall and new repo folder, I went to configure JRE's when creating a project and set both options to v1.8 . It's working now!
I've spent about 10 hours on this already and tried and retried solutions I found on the net, but I'm not finding any new solutions, and getting no where with the ones I've tried. Could you assist?
Background:
I'm new to dev environments like this, so there could be something simple I missed. I'm trying to learn to create Alexa Skills and compile a set of sample files with Maven:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/deploying-a-sample-skill-to-aws-lambda
And I'm running this through:
mvn assembly:assembly -DdescriptorId=jar-with-dependencies package
I'm on Windows 7 Pro x64. I installed jdk-8u60-windows-x64.exe.
Using windows CMD (would be happy for suggestions on a better terminal though!)
Not running Eclipse.
C: is root, but I installed the JDK to E:\Program Files\Java\jdk1.8...
I setup JAVA HOME - to the root directory - E:\Program Files\Java\jdk1.8...
I setup PATH with \bin; added to the front. Note: There was already a path in there for \oracle\java, but I tried with and without that with no change.
I setup maven with M2 and M2_Home.
After all that, I still got the compiler not associated issue. So I tried a bunch of stuff:
Uninstalled everything and reinstalled everything (x64) with "Run as
Administrator."
Put all PATH and _HOME values in User and System Settings.
Uninstalled everything, reinstall everything as Admin, but x86 this
time.
Repeat Path and _Home steps with new Program Files(x86) location.
For every PATH and _HOME I also tried Progra~1, Progra~2 instead of
"Program Files".
Nothing worked.
I still get the error no compiler associated. There is no Javac.exe in my bin after any install either.
And I have a lot less hair now. Any help would be great.
Finally got it working. Nothing new. Reinstall, that's it, but with a difference. I re-installed the JRE in a different location from the JDK. Probably noobie mistake(?). When I first installed the JDK, I didn't have the JRE. The JDK installer also auto-installed the JRE, but first asked me where to put it. This screen doesn't specifically reference JRE apart from JDK. And me, not really understanding the difference between the two, nor the need for another install location, just used the same folder. That was probly the issue, because now it's working perfectly. Thank you all.
When I work on an android application in Eclipse, R.java never appears. I did the following to try to fix it:
delete ~/.eclipse folder
reinstall eclipse
create a new workspace
reinstall android developer tools
reinstall operating system
None of it worked. Even the Hello World! application that is created by default won't build. What do I have left I can do?
UPDATE:
There aren't any problems in Problems other than the two "R cannot be resolved to a variable"s. The Error Log tab shows an error Failed to load properties file for project from when I created the project. I think that may be a good clue as to what the root issue is.
ANOTHER UPDATE:
It's not a permissions issue, since the same thing happens when I run Eclipse as root. 'Fix Project Properties' does nothing. When I comment out the references to R.java, the problem is not resolved (the reason it doesn't run is [2013-07-08 21:47:37 - AppName] Could not find AppName.apk!
)
YET ANOTHER UPDATE:
running eclipse as root works now.
OS is 64-bit Arch Linux
Make sure that you have no xml related error( open and check all xml files, including the manifest manually).
Clean your project.
Change the build target version.
Make sure that you have Android SDK build tools. It comes on updating the ADT plugin.
Try these things:
Check in the properties of the project, in the Android tab if you have downloaded the version of the API that you are using. (See this in the SDK Manager)
Look into your /res folder. Scan for every file. Does any one has problems? If one resource has a problem, the R.java file is not generated.
Check the AndroidManifest.xml file. Look for warnings or problems, especially the use of the <uses-sdk> tag.
If none of these appointed the problem, try to build a simple java application. Does it work? Are you using the JDK 1.6?
Finally, if you are still stuck, download the Android ADT and use it as your IDE. It has all you need.
If your O/S is 64-bit Linux you will encounter Problems with the ADT because it is a 32-bit application. You have to install the following 32-bit libraries:
sudo apt-get install ia32-libs
Conversion to Dalvik format failed: Unable to execute dex:
wrapper was not properly loaded first
[project]
Android Packaging Problem
I've never worked with Java or eclipse before, I'm following this introductory guide and all searches via google return no helpful results. I'm guessing the problem is I have built Android stuff with eclipse properly but I have no idea, I followed this guide to the letter and everything went as it explains it should.
Any ideas what caused this problem, or is it specific to the guide? If so I'll post on their help page.
I have tried doing project -> source -> clean up, but that didn't fix anything.
Edit:
I went to Project -> Android tools -> Dex bytecode and it reported:
DexDump: missing classex.dex for project. Please compile first.
So I guess that's my problem! Not sure how to solve though.
Go to Project -> Clean
It will rebuilt workspace and fix the errors if any.
As I said, I had the same problem so I tried all the different versions and
then I stopped filling in the SDK-version number
and finally it did not complain anymore about the wrapper.
After that it was totally fine to write the SDK-version when I created new projects.
Hope it works out for you too.
Had the same problem (running on Windows 7). I resolved it by running Eclipse with Administrator privileges.
try to run eclipse under administrator permission. Problem may be resolve.
I think you installed the SDK in "Program Files" folder . So for do something inside, must have administrator permission.
One thing that may help is to create a new test Android project.
In Eclipse, select File → New → Android Project.
Set the project name to "Test3", check Android 2.3 for the build target, type "com.example.android.apps.test3" for the package name, and type "Test3Activity" in the "Create Activity:" text box. The form should look like:
Click Finish.
Expand the entry for "Test3" in the Package Explorer. Navigate to res/values/strings.xml. Double click on the entry for strings.xml:
Set the text content of the string element having name "app_name" to "Test3":
Right click on "Test3" in the Package Explorer and select Run As → Android Application. The emulator should open and after a long while, you should see:
If these steps do not work, then you probably have an error in your installation.
Try it out and let me know.
I had the same problem earlier today. Google was largely unhelpful.
I fixed it by removing the project from eclipse, then re-importing it.
According to this bug report the problem is caused by upgrading to version 9 of the SDK.
Had the same HelloWorld problem with Ubuntu 64 Lucid / Eclipse 3.5.2 from Ubuntu repository. Restarting Eclipse did the trick, though I notice it still fusses about API level requirement when HelloWorld is run.
Running it as Administrator has solved this issue for me..
Had the same problem - occurred after I tried downloading Android platform v2.3.3 (was using 3.1 and 3.2 earlier) and it interrupted in the middle - restarted eclipse and cleaned all projects and rebuilt and the problem went away
At what point in this tutorial/guide are you running into this problem and did you make sure to include your package information in each file or ie com.something.somethingelse at the top of your class or classes?
Perhaps a registry error or maybe even a problem with activity implementation.
Please post your code if this did not start you in the right direction.
Here are a few things to check:
Make sure you have the latest version oF Eclipse (Helios)
Make sure that you have the Android SDK plug-in for Eclipse.
Now if you have done that... Make sure that any classes you add (Each screen you view on Android is a class and is called an Activity) are in your androidmanifext.xml file See http://wrenbjor.com/2011/01/12/the-androidmanifest-xml-file/ for help on understanding this process.
otherwise make sure there are no red x's in your code or it wont work.
If you still have problems post some code and we can try to help.
Had the exact same problem the other night. Upgraded to Helios (3.6) and it went away, quite possibly as a side-effect.
Under windows 7, rather than run eclipse as an admin, change the permissions on the eclipse folder so the creator/owner has full control, and do the same with the folder the android SDK is installed into.
I had installed Eclipse using the files provided by Windows' native ZIP extractor. I deleted the files and took them from 7-Zip instead. Now the error is gone. So maybe using another ZIP extraction tool will help.
Recently got this when failing upgrade using adb-manager with eclipse open (win32). As eclipse was open, upgrade failed. Then returning to my project this problem occured.
Was solved by closing eclipse, restart as administrator and cleaned project.
I had the same problem but I resolved it using following steps(using eclipse helios and windows XP ) :-
Right click on eclipse.exe.
click on Run As...
Uncheck the checkbox before "protect my computer from unauthorized activity".
And it is running for me as expected !
hope it will also run for you.