Xamarin - VS 2015 - looking for jdk1.7.0_71 - java.exe - java

I have just installed Xamarin into my existing VS2015. I have a Win 7 64 bit machine. When I start a simple Xamarin.Forms project and try to build and deploy onto an Android emulator, it throws an error -
"The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\bin\java.exe" is invalid."
In Options->Xamarin->JDK Settings = "C:\Program Files (x86)\Java\jdk1.8.0_91\"
I have uninstalled JDK 1.7 from my machine, and restarted my machine. There is no difference.
I also have a 64 bit version of JDK and my JAVA_HOME points to that, which I cannot change just for Xamarin.
Where in the world is Xamarin picking up this path from?
How to fix this issue?

I had this problem too and I solved it deleting the file sdks.cache.
You will find it in the folders OBJ (Debug or Release) and BIN (Debug or Release) of your project.
This file contains some variables configuration. This problem is because the node is targeting to wrong path (C:\Program Files (x86)\Java\jdk1.7.0_71).
Deleting the file is safe because it will be regenerated again with the next build but in this time will use your Xamarin configuration to set node with the configured path.
I hope this help you to solve your problem.

I had a similar problem when I had both versions of Java installed in my system (1.7 and 1.8). Despite Xamarin -> JDK settings pointing to 1.8 version, the error
specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\bin\java.exe" is invalid
was still displayed.
This issue can be resolved by following the steps below:
Uninstall Java 1.7
In Microsoft visual studio, click on the solution (in solution explorer) right click and select "Clean"
Ensure your Xamarin -> JDK settings point to Java 1.8 version
Rebuild the solution

Java installed version and Xamarin referred different version .. Please config correct Java version in the Xamarin In Options->Xamarin->JDK Settings.
Thanks

Xamarin.Android currently requires 32-bit Java JDK 7 (1.7). The latest version is 1.7 update 79.
Xamarin.Android also requires that a 32-bit Java JDK 7 (1.7) be installed. Later versions of the JDK can also be installed alongside JDK 7, if required by your machine.

Related

What is the latest Java SDK that can be used for Android app development?

I recently bought a new MacBook. I installed the Android SDK and Studio and then I imported my project. AS suggested to use the bundled Open JDK for my project. I accepted and I am able to build and run my project via AS.
The problem is, my command line doesn't work :(
==> ./gradlew clean
No Java runtime present, requesting install.
After running the above code the following alert displays. This web page will be open when I click on the More Info button.
After I searched I realized that I have to have JDK installed on my laptop. I remember -from thousand years ago- that I have to have JDK 8 on my laptop. I also heard that android projects work with JDK 11.
It looks like the latest JDK is 15. So, what should I do? What is the latest JDK that can be used for Android app development?
Anything Java 8 or above is fine.
Find path to JDK in File > Project Structure, Tab SDK Location > JDK Location.
In MacOS, installed Virtual Machines are normally placed in /Library/Java/JavaVirtualMachines/*

Android Studio: "Gradle sync failed: Could not run JVM from the selected JDK."

Ever since installing Android Studio 3.2, I haven't been able to run Java, I have tried jdk-8u181-windows-x64, jdk-10.0.2_windows-x64_bin, jdk-11_windows-x64_bin, setting PATH and reinstalling everything umpteen times, the result is the same - no "java" appears and the error message is: -
Gradle sync failed: Could not run JVM from the selected JDK.
Please ensure JDK installation is valid and compatible with the current OS (Windows 8.1 6.3, amd64).
If you are using embedded JDK, please make sure to download Android Studio bundle compatible
with the current OS. For example, for x86 systems please choose a 32 bits download option. (369 ms)
Notes: I used to be able to open the java folder but after playing with it too much, something went wrong, so, I decided to start afresh... and I am dead ever since.
Is Studio 3.2 flawed? Not compatible with Java at all? Or am I missing something? is there a older Android Studio I can test? Thanks for any help you may provide.
In my case, the following solved it:
File->Other settings->Default Project Structure...
In "JDK Location", I previously had the oracle jdk selected. To fix this issue, I instead checked "Use embedded JDK (recommended)"
Solved YES
Other Settings ---> Default Project Structure ---> Uncheck Embedded jdk ( Write Your Own jdk Location )
In my case, the following solved it:
File->Other settings->Default Project Structure...
setting the JAVA_HOME environment variable to C:\Program Files\Java\jdk1.8.0_181
my JDK Source File
Try setting your SDK location. I had the same problem with Android Studio 3.2 (but I also switched to openjdk, so that could be the source of my problem). Anyway, after pointing SDK location to the root of my JDK it worked like a charm.
To change SDK location click on the Android project Window and then press F4. In the new Window choose SDK location and set it to point to the root of your JDK.
i got mine working by setting the JAVA_HOME environment variable to C:\Program Files\Java\jdk1.8.0_181\bin my jdk folder

IntelliJ Gradle Plugin: The supplied javaHome seems to be invalid

Similar to:
- Intellij 14 the supplied javaHome seems to be invalid
- Android Studio - supplied javaHome is not a valid folder
However, I am trying to use my JAVA_HOME variable which is set to C:\Program Files\Java\jdk1.8.0_40
I do not understand why intellij is looking for the JDK inside of its install directory.
In intellij:
Executing external task 'bootRun'...
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1\jre\bin\java.exe
External task execution finished 'bootRun'.
C:\>java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
C:>env
...
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
...
In my case the answers above didn't work.
Here's what work for me:
I needed to change Gradle JVM to point to the actual JDK:
IDEA comes in 2 versions: 32bit and 64bit.
Your JAVA_HOME is 64bit version of Java so you have to run 64bit version of the IDEA ...\IntelliJ\IntelliJ IDEA Community Edition 14.1.2\bin\idea64.exe.
Otherwise, you can provide 32bit JDK or tweak the behaviour with IDEA settings
https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
Try manually setting a JDK from File > Project Structure > Project > Project SDK, Then rebuild.
If someone faces this error after Android Studio update to Android Studio Electric Eel | 2022.1.1 than simply follow following steps:
Go To android studio directory (Default C:\Program Files\Android\Android Studio)
remove jre folder
run cmd as administrator
cd C:\Program Files\Android\Android Studio
mklink /D "jre" "jbr"
Thanks to this link
This can be fixed by setting the Project SDK in Module settings to a JDK (as opposed to the Module SDK (which shall be Android SDK)
I tried this and it worked for me flawlessly.
go To SETTING-->SEARCH 'Gradle'---> and choose Gradle JVM and choose the option Use JAVA_HOME C:\ProgramFiles\Java\JDK\1.8
hope this helps someone.
I've solved this issue by putting gradle.properties file in the same dir as build.gradle with exact path to my JDK:
org.gradle.java.home = C:/Dev/JDK
Actually it is not a correct solution, probably it should be fixed in IDE, I see in IDEA logs something like (when I executing gradle task of already imported project):
INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Dev/JDK
But when I going to import gradle module to the project I don't see such kind of message, probably IDEA passes link to bundled JRE which is actually not a JDK.
In my case I delete ".gradle" folder and let android studio and react native download it again then problem get solved ...
Notice: I'm using windows
The problem lies in Intellij IDEA itself. If you go to Intellij installed directory, you will find a jre directory where it's searching for the above said java.exe. But the problem here is there is no bin directory here instead another jre directory available.So, solution is upfront. copy all the contents from inner jre directory and put it in outer jre directory.
If someone faces this error after the Android Studio update to Android Studio Electric Eel | 2022.1.1 then simply follow the following steps:
Go To the Android studio directory (Default C:\Program Files\Android\Android Studio)
2. Just you need to copy all content of jbr folder to jre folder.
UPDATE I believe this issue has been fixed as of 14.1.3
Related bug links:
Intellij 14.1 cannot Import correctly Module with Gradle
That said, I was able to get by using #Sergii Pechenizkyi's answer; however, it seems like this problem has a few different solutions.
On OSX 10.12.x, Intellij v16.3, I had to go into:
~/Library/Preferences/IntelliJIdea2016.3
Create a file called: idea.jdk
Add the following to it: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk (or whatever JDK you have installed
This was a fix I've had to do in v16 of Intellij found on jetbrains site. At one point I had to remove it, on the upgrade to 16.3 I had to add it back.
https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
I encountered the same problem for quite a while and no matter how many forums I looked at it just did not solve the problem.
Long story short, I found out my antivirus quarantined the java.exe file. So I advise you to open your antivirus and restore the Java.exe file then relaunch android studios.
in my case I had to delete cached java directory from Program Files/Common Files folder. This directory had previous java executa ble cached. Deleting this folder allowed system to recognize latest java executable
Upgrading IntelliJ UE from v14.1.1 to 14.1.7 worked for me.
It is not working on the Mac as of 16.3. The SDK was set correctly in Project Settings and the Gradle dialog box no longer allows you to select the JDK. The only solution that worked was creating the gradle.properties file.
in IntelliJ 2018.1, I ran into this problem because my project SDK was set to Kotlin instead of a JDK. So, despite having a Kotlin project, it would only build if the SDK is a JDK.
After trying all above solution nothing worked for me. Then i looked whether the "Use project jdk" path for java is correct. To look it under
File->settings->gradle-> gradle jvm
I found that jdk got updated and gradle was using old jdk version.
So, solution was to update Project jdk path for java in intellij.
File->project structure->Platform setting->SDK, here update your right jdk path. thus the problem got solved for me.
Had JDK 18, installed 17, and uninstalled 18. Then the error popped up.
None of the solutions above worked.
The quick fix was to delete other java folders in C:\Program Files\Java.
That's it!
This solution works for me
So it seems Gradle keeps its own registry. There was a file called ./gradle/daemon/7.2/registry.bin in my user directory that was caching the invalid jdk path and once I deleted it I was able to build.
If someone faces this error after Android Studio update to Android Studio Electric Eel | 2022.1.1 than simply follow following steps:
Go To android studio directory (Default C:\Program Files\Android\Android Studio) remove jre folder run cmd as administrator
cd C:\Program Files\Android\Android Studio
mklink /D "jre" "jbr"
If you get this error after updating Android Studio Electric Eel the jre location changed, before there was a "jre" folder in the Android Studio folder, now its called "jbr" so you must update your system environment variables to this new path and restart Android.
when you update your java sdk then its happen you must change lots of config. file but make sure you always put same kind of config in every file config . In my case i upgrade my java SDK tp 19.0.2 `
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.google.gms:google-services:4.3.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Open the C:\Program Files\Android\Android Studio\jbr and copy all of the folders and files and paste to C:\Program Files\Android\Android Studio\jre
Define the JDK on Users env , in path -> C:\Program Files\Java\jdk-19\bin , define with path root in users path ,
Define JDK on System env , in system path define without \bin root , like that -> C:\Program Files\Java\jdk-19 , it will be okey

Error: jdk1.7 or higher needed to run Google plugin for eclipse

I have been trying to make this work all day long but there seems to be no end to my frustration. I want to use Google App Engine for my android application. I have downloaded the jdk 1.7 u51 but still whenever i start the eclipse ADT, a dialog box appears saying that jdk 1.6 is in use; jdk 1.7 or higher needs to be installed. I have set the path in the preference to jre inside the jdk 1.7. Also, the app engine SDK path shows the error "Failed to initialize App Engine SDk[path]". I have referred all the threads here and over the internet relating to this issue and have tried all the proposed solutions but to no avail. Any help would be greatly appreciated.
versions
eclipse 4.2(ADT)
JDK 1.7u51
App Engine SDK 1.8.9
Try uninstalling the old java version, and making sure that the latest version is the only one installed. Another problem might be if you have a 64-bit computer, you may have the older version installed to one program files, but Eclipse is looking through the x86 program files and not finding the correct version(or vice-versa). You may also want to set your PATH and CLASSPATH.
Type
java -version
javac -version
into the command prompt, and it will return with what Java you have installed.
If all else fails, try reading https://developers.google.com/appengine/docs/java/gettingstarted/installing for more information and see what went wrong.
You must have matching architecture for Eclipse and JDK. If you are using 32-bit eclipse, then use 32-bit JDK else use 64-bit versions of both.
Everything else will fall in place automatically
I am using Indigo and found this forum thread to do the trick.
To your eclipse.ini file add
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_WHATEVERTHESUFFIXIS/Contents/Home/jre/lib/server/libjvm.dylib
Note the suffix "lib/server/libjvm.dylib" which is not what you use for later versions of Eclipse. (For them you link to "bin/java".) This needs to be above any "-vmargs" flags in eclipse.ini.

how to configure JDK as the default JVM in my workspace

Im trying to create a new grails project using the IDE GGTS (groovy and grails tool suite )
but it says that grails needs a JDK and JRE is not enough , I already installed JDK 1.7 and added the JAVA_HOME to the path
i also copied the grails folder and added a GRAILS_HOME to the path
in GGTS :
i tried In Window>Preferences>Java>Installed JREs to check JDK1.7.0_51
and
In Window>Preferences>Java>Installed JREs>Execution Environments I choosed JavaSE-1.7 and checked JDK1.7.0_51[perfect match]
the JDK installed is 64 bits and My PC is windows 8 64 bits
but the error persists
We have to make sure that the Java run time of our eclipse IDE points to a JDK instead of a JRE. Here are the steps:
Go to Window->Preferences
Edit Installed JRE if it is pointing to a JRE installation
Change it to the JDK installation directory. It is better if you also change the name

Categories