Windows version error when installing Android Studio 3.1 Preview 2 - java

I am getting the following error when trying to install Android Studio 3.1 Preview 2 on Windows:
Error: CreateProcess error=216, This version of %1 is not compatible
with the version of Windows you're running. Check your computer's
system information and then contact the software publisher.
I have tried to install the following - but still didn't help:
Install jdk1.8.
I also tried the following in Android Studio:
File->Project Structure->SDK Location (select your directory where the JDK is located, by default Studio uses embedded JDK) -> Click OK
But for some reason this produces error=216.

Related

Properly configure JDK to run react native project

I am trying to run a react native app on a m1 mac, generated with react-native-starter-kit.enter link description here. When I run the app with npx react-native run-android, I get the following error
error Failed to install the app. Please accept all necessary Android
SDK licenses using Android SDK Manager:
"$ANDROID_HOME/tools/bin/sdkmanager --licenses".
I tried to run the sdkmanager as following
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
I get an Error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Then I tried this JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
And it works, All SDK package licenses accepted.======] 100% Computing updates...
But when I run npx react-native run-android after that, I still have a licence error
Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager
I have the feeling I am accepting the licenses in the wrong JDK. Any idea?
You should make sure that you set up you development envoirement the correct way.
The Official Guide explains it step by step.
For you paragraph 2 (Install the Android SDK) should be helpful

Java SDK 11.0 or above is required when using .NET 6 or higher

I've installed .NET 6 (version 6.0.100-rc.1.21458.32) and Visual Studio 2020 Preview (although it might be not a prerequisite).
I am trying to debug a hello-world application but I am getting a build error regarding Java.
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.100-rc.1.12\targets\Microsoft.Android.Sdk.Tooling.targets(20,5): error XA0031:
Java SDK 11.0 or above is required when using .NET 6 or higher.
I've installed Java 17 setting Path as well as pointing to the Java Development Kit Location in Visual Studio settings (tools->options->Xamarin->Android Settings). Because that didn't work I've set the JDK location to Microsoft's openjdk, but it still doesn't work.
What's wrong here?
Installing Microsoft's OpenJDK 11 did the job for me.
You may notice that Visual Studio installs a version of Microsoft
OpenJDK, however, you need to install the Microsoft OpenJDK 11
When I installed VS2022 preview 4, my configuration became C:\Program Files\Microsoft\jdk-11.0.10.9-hotspot
This can be fixed for you if you run the maui-check command (if you installed that component during visual studio installation).
If you don't have the maui-check tool, you can get it by running the dotnet tool install -g Redth.Net.Maui.Check command
Maybe you skipped a step during installation and that's why you get the error.
For those who have the same problem in Jetbrains Rider :
Install OpenJDK 11 (Microsoft's OpenJDK 11 seems to be better) as mentioned by #themelis
Press Ctrl + Shift + A and search MSBuild global properties or go to File > Settings > Build, Execution, Deployment > Toolset and Build
Edit the MSBuild global properties and add the following property:
Name: JavaSdkDirectory
Value: {OpenJDK installation directory} (mine is C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot)
Save and Enjoy!
Visual Studio for Mac
Here's how I got it working on macOS with Visual Studio for Mac.
Install Microsoft Open JDK
On macOS, install the Microsoft Open JDK using HomeBrew:
brew install --cask microsoft-openjdk
Configure Visual Studio for Mac
In Visual Studio for Mac, select Visual Studio -> Preferences.
In the Preferences window, navigate to SDK Locations -> Android -> Locations.
In the Java SDK (JDK) Location: text box, enter the following:
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
Click OK

Flutter doctor results with "cmdline-tools component is missing"

I have tried the answers at here & here to no avail.
After installing Android Studio & Flutter on Windows 10, when I run flutter doctor, I get the following:
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1202], locale en-US)
[X] Android toolchain - develop for Android devices
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.60.0)
[√] Connected device (2 available)
Opening Android Studio > SDK Manager > Android SDK > SDK Tools uninstalling and re-installing Android SDK Command-line Tools (latest) has no effect.
I have also added <pathToSDK>\tools\bin, <pathToSDK>\platform-tools\, and <pathToSDK>\cmdline-tools\latest\bin to the user PATH environment variables.
Following the flutter instructions and running <pathToSDKManager> --install "cmdline-tools;latest" (Which for me is located in <pathToSDK>\cmdline-tools\latest\bin) results with:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
I haven't been able to find any documentation on this other than that I need to install some version on Java and add it to my path. The https://flutter.dev/docs/get-started/install/windows page mentions "Make sure that you have a version of Java 8 installed and that your JAVA_HOME environment variable is set to the JDK’s folder." and then states "Android Studio versions 2.2 and higher come with a JDK, so this should already be done." but doesn't elaborate further.
Opening Android Studio and going to File > Project Structure > Project > Project SDK I can see that Android Studio already recognized several versions of Java installed:
You can follow the below steps in order to ensure proper working of your flutter project:
Your sdk manager should look something like this:
1. Installing Android SDK Command-line Tools in Android Studio:
Preferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools >
Install these 3 tools:
Android SDK Command-line Tools (latest)
Android SDK Build Tools 31
Android SDK Platform tools (latest version 31)
Make sure every tool is the same latest version in order to avoid any errors as there might be new updates later on.
Also make sure to Accept Android Licences by running below command in your cmd:
flutter doctor --android-licenses
If anything above didn't work out make sure you have set the proper JDK/JRE locations in environment variables in system settings of windows:
Add below path in your System environment path variable for user variable as well as your system variable:
C:\Program Files\Java\jdkXXXXX\bin
Here, XXX is your version, and this should be added in your sys var and user both
C:\Users\Neha\AppData\Local\Android\Sdk\tools
C:\Users\Neha\AppData\Local\Android\Sdk\build-tools
C:\Users\Neha\AppData\Local\Android\Sdk\platform-tools
The above three paths should be added in your user variable path. Check the two screenshots attached below for proper path settings.
I have added android studio's tools path also so do that as I have done in screenshot.
This one is for user variable path:
This one is for system variable path:
Follow source to learn more about setting the path for java.
Just Install them:
Android SDK Command-line Tools (latest)
Android SDK Build Tools 31
Android SDK Platform tools (latest version 31)
run: 'flutter doctor --android-licenses'
after run 'flutter doctor' again.
And boom. it will work.
In the screen you've shown, just use "Android Studio default JDK" (or any other JDK 11).
Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK.
You'd also need to setup the same path as JAVA_HOME environmental variable, as well as ANDROID_HOME. In Windows, these can be added below Settings > Advanced System Settings > Environmental Variables. Flutter needs these set up to find the CLI tools ...
and the problem might not be the CLI tools themselves, but that it doesn't know about the Java SDK or Android SDK at all.
If you are installing Flutter without Android Studio.
Run this command in your Android/bin folder directory where you have your sdkmanager.bat file.
In my case its C:\Android\bin>.
type this command
sdkmanager.bat --install "cmdline-tools;latest --sdk_root=../
This worked for me and I hope it will work for you too.
If you have installed Flutter without Android Studio. Run this command in your Android/bin folder directory where you have your sdkmanager.bat file. In my case its C:\Android\bin>
sdkmanager.bat "cmdline-tools;latest" --sdk_root=../

error=216, This version of %1 is not compatible with the version of Windows you're running

I'm having issues with running my first project in Android Studio.
My system information is:
I installed Android Studio 3.3 for Windows 64-bit from here:
https://developer.android.com/studio/?gclid=Cj0KCQiAj4biBRC-ARIsAA4WaFghk17DIUiHKwmX4-yiQfRpBRkxKqR8beYvgZE2mN5hmgAi2uWtFYQaAgpSEALw_wcB
However, when I create a new empty project and try to run it I get the following error:
error=216, This version of %1 is not compatible with the version of Windows you're running
I tried using the embedded jdk and also changing it here (using jdk I installed previously for other purposes):
I also get the following error:
Emulator: Warning: restoring GLES1 context from snapshot. App may need reloading.
Any help would be much appreciated.
Thank you.

Android Studio and JRE on OS X

Installing AndroidStudio 2.0 on OS X El Capitan: if I install JRE 7 from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html, I will not receive Public Updates; if I install JRE 8, Android Studio complains that it cannot use secure connection to receive upgrades:
Is there a way to convince AS that JRE 8 is not JRE 6? If impossible, which compromise is preferable: downgrade to JRE 7 and establish secure connection for Android Studio upgrades, or keep the latest JRE and wait for Android Studio fix?
From the documentation, by default Android Studio is launched from java 6: http://tools.android.com/tech-docs/configuration/osx-jdk
As it is mentioned you can export an env variable to indicate Android Studio what jdk to use :
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk<version>.jdk
In order to keep this env variable accessible from the GUI, you can add the following line to your ~/.profile file :
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk<version>.jdk
Hope it helps.
Another solution for OSX: go to the Applications folder, right click on Android Studio, choose "Show Package Contents".
Open the Info.plist file. Locate the JVMVersion key, and set the string value you need.
In my case, I needed to be 1.7 and up to be able to run the RoboVM plugin, and the value was 1.6*,1.7+, so I left it only on 1.7+.
Restart Android Studio and it should be using the version of the JVM you need.
This works if you have root access on your Mac.
refers to Android Studio IDE with private jre/jdk? OSX
In Android Studio 2.1.2 and below,the default settings is '1.6*,1.7+'.
In the latest version of Android Studio(2.2 Preview 7),the default settings is '1.8*,1.8+'.

Categories