I have set JAVA_HOME in my system
ERROR: JAVA_HOME is set to an invalid directory: C:\Users\Yazan\Downloads\jdk-19.0.2
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
in android studio and I get error I'm restart the device but the same problem stay.
Make sure you've extracted the zip, and it will look like
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=c:\Users\krishna kale\AppData\Local\Android\Sdk (DEPRECATED)
Requirements check failed for JDK 1.8.x! Detected version: 17.0.1
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
[ERROR] An error occurred while running subprocess cordova.
getting this problem I didnt want to chnage my envirment variable is there any way to build this by changing dependencies in Application?
why this problem is occures?
If you are using ionic 1 - 3, you need to change the environment variables. I have tested Ionic 3 with other java version other than 1.8, and it didn't work.
The newer java version has a new path created under "System variables" > "Path" on the top.
You can retain 2 java versions and revert back to your current java version (17.0.1) once you have built your app.
You can follow these steps:
Download and Install Java SDK 1.8 from the official website.
Once installed, it should be saved in C:/Program Files/Java directory
Go to your Environment Variables > System variables
Click on "New.." to create a new variable.
Variable name = JAVA_HOME and Variable value = C:\Program Files\Java\jdk1.8.0_321 or check on your directory.
Then double click on "Path" variable under System variables.
Click "New" and add %JAVA_HOME%\bin
Once created, select the newly created environment and move it to the very top (Make sure that it's above C:\Program Files\Common Files\Oracle\Java\javapath)
Reverting back to original version
Go to System variables and double click on "Path"
Remove the newly created variable = %JAVA_HOME%\bin
You should get back your original java version.
I am setting Flutter for the first time and I keep getting this error when trying to run the Flutter code on a Pixel 2 emulator:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I tried deleting and reinstalling Android Studio and Java SDK, but it does not solve anything.
I tried setting the JAVA_HOME variable in environmental variables with the following path:
C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1
...but nothing, same error.
Thanks for your help
Important Notice:
My android sdk is installed on the D partition, while the Java sdk is on the C drive. Does it matter ?
Open powershell and write java --version
If you dont get the version try to add again the Java_home to path
Nevertheless, I think java home should be on C:\Program Files\Java\jdk-16.0.1\jdk-16.0.1\bin directory
I reinstalled my android studio since the sdk was not found and so on. After re installing java jdk and android studio , everything worked well until I got an error saying 'Could not initialize class org.codehaus.groovy.runtime.InvokerHelper' which I solved by changing the Gradle version. And now the error is 'Type 'FlutterTask' property 'assets' is missing an input or output annotation.'
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\loran\ASProjects\xylophone-flutter\android\settings.gradle' (C:\Users\loran.gradle\caches\6.8.2\scripts\4mawlyb2l5e9tefyvnpxva1kg).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 60
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 46s
Exception: Gradle task assembleDebug failed with exit code 1
I also had this problem So I did install java 8
You might have Java 13 So install Java 8
Java JDK 16 is the one that seems to lead to this issue try downgrading by downloading a lower version of JDK preferable JDK 8 or 11
To future individuals who will run to this error. Here is the link to download the JDK enjoy your coding experience don't forget to change the path too.
https://www.oracle.com/java/technologies/javase-downloads.html
mainly you have jdk16 i tried to install java 8 and set env to java 8 it worked for me
Try installing the latest Gradle package gradle-7.1.1, if you are using Java JDK 16 installed. To do this open android/gradle/wrapper/gradle-wrapper.properties file and under distribution url, update the gradle version to 7.1.1 (or the latest). After that, inside your Flutter project directory, run the following command in the terminal:
cd android && ./gradlew
I removed the JAVA_HOME path to the JAVA download and changed JAVA_HOME path to the following:
C:\Program Files\Android\Android Studio\jre
I am now coding
FOUND IT !
No need to change your JDK version, follow the steps to resolve the issue:
check your java version and remember it, use "java -version" in terminal
go to your android studio path installation
then in: Android Studio/jre/ open the file named "release"
take attention of the value of JAVA_VERSION field
if it's not the same as the java version on your computer, just change it with the version installed on your computer.
That's it, i hope it will resolve your issue like it resolves mine.
Try it and give a feedback.
Try this!
Remove package android from the top of settings.gradle. This helped me out.
If this error occurs, this might because you have installed the latest JDK such as JDK 16. You download and install JDK 8 and uninstall JDK 16. Then restart the desktop/laptop and try launch and run flutter run again. It should be working fine.
In my case, on Windows 10, my JAVA_HOME was set to JAVA SE 16 C:\Program Files\Java\jdk-16 and when I looked at the release file in java jre in android studio, C:\Program Files\Android\Android Studio\jre\release, I found that the the JAVA_VERSION WAS "11.0.10" (java 11) for short. So I changed the java installation on my PC to Java 11, update JAVA_HOME in my environment variables to point to the new java (C:\Program Files\Java\jdk-11.0.12) and restarted android studio, Then everything worked.
You can get your java 11 from here.
https://www.oracle.com/java/technologies/javase-jdk11-downloads.html. Change 11 to 8, 16 etc to get the download link for the java version you need.
The problem has to do with having Java 13 or 16 installed on your computer. The current version of Flutter does not work with Java 13 and 16. Just uninstall either of these that you may have installed and installed Java 8 or Java 11. Restart your computer to effect the update. Everything should be fine afterwards
I got this error when using flutter. I fixed it ensuring the android-studio-dir path was set correctly.
You set it up using flutter config --android-studio-dir="android studio path".
Then run flutter doctor and ensure flutter can see Android Studio
In 'adnroid/gradle/wrapper/gradle-wrapper.properties'
Change distributionUrl to version 7.0.1
In 'android/build.gradle'
Change 'com.android.tools.build:gradle' to version 4.2.0
Java 11 is the only supported version by Flutter as for now. It compiles and installs.
Previously I had this error using Java 19 and Java 8.
You might want update your gradle version.
Check the supported gradle <-> kotlin <-> java version on their page.
You can try this, it works for me.
Open the android module to a new window and automatically download all necessary libraries after successfully building finished run the app.
Simply go to your Android Studio path -> C:\Program Files\Android\Android Studio
open jbr folder -> copy all files -> then go back -> paste all the files in the jre folder and "replace the files in the destination".
It works for me in two different laptops. I have latest jdk version - 19.0.2
The error message you're seeing is related to the flutter build process and it occurs when a required input or output annotation is missing from the assets property of the FlutterTask.
task buildFlutter(type: FlutterTask) {
// Add the #Input annotation to the assets property
#Input List<String> assets = ["assets/images/", "assets/fonts/"]
}
Try to disable AVAST, check system vatiables path for JDK and SDK, clear cache with yarn.
This error occurs when I try to build&Run my game with Unity. I've also imported the GooglePlayServices/ads from here and also have the latest android sdk and jdk-8u144.
Here is the Error Log:
Gradle failed to fetch dependencies
Failed to run 'Temp\PlayServicesResolverGradle\gradlew.bat -b Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts. gradle --no-daemon "-PANDROID_HOME=C:/Users/rfkha/AppData/Local/Android/sdk1" "- PTARGET_DIR=C:\Users\rfkha\Documents\Space Shooter\Assets\Plugins\Android" "- PMAVEN_REPOS=https://maven.google.com" "- PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:11.2.2"'
stdout:
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.
stderr:
exit code: 1
UnityEngine.Debug:LogError(Object)
GooglePlayServices.PlayServicesResolver:LogDelegate(String, LogLevel)
Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
GooglePlayServices.<GradleResolution>c__AnonStorey14:<>m__20(Result)
GooglePlayServices.<GradleResolution>c__AnonStorey15:<>m__29()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
2nd Error:
Resolution failed
Failed to fetch the following dependencies:
com.google.android.gms:play-services-ads:11.2.2
UnityEngine.Debug:LogError(Object)
GooglePlayServices.PlayServicesResolver:LogDelegate(String, LogLevel)
Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List`1)
GooglePlayServices.<DoResolutionUnsafe>c__AnonStorey17:<>m__26(List`1)
GooglePlayServices.<GradleResolution>c__AnonStorey14:<>m__20(Result)
GooglePlayServices.<GradleResolution>c__AnonStorey15:<>m__29()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
add JAVA_HOME to your environment variables for mine it is C:\Program Files\Java\jdk1.8.0_144 It worked for me maybe it will for you.
For me latest Google Play Services resolver cannot copy library play-services-ads.aar to /Assets/Plugins/Android. I have to copy it manually from sdk folder:
sdk\extras\google\m2repository\com\google\android\gms\play-services-ads
to my
/Assets/Plugins/Android folder.
Delete all Google AdS files from the Asset Name folder and re-import the Google AdS package.
Or
-Right click on "my computer" and go to properties.
-Go to the Advanced tab
-Click on the Environmental Variables button
-Find the JAVA_HOME variable under System Variables
-Change the value to wherever this file actually exists for you. (for me it was C:\Program Files\Java\jdk-10)
-Restart Unity
I had to add the Jdk address as given in unity->Edit->preferences
and paste the address in the JAVA_HOME variable value.
then I restart my system and it fetched all the android dependencies and started working.
if it does not start fetching on its own you can force resolve the android dependencies.Assets->ExternalDependencyManager->AndroidResolver->force Resolve.