Using Gradle on Windows 10 for Android Studio - java

I am trying to setup Gradle on Windows 10 so I could use in my Android Studio. I am trying to run the command ./gradlew clean build But getting this below:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
What I have done.
I have downloaded and Extracted the downloaded zip file named gradle-3.3-all.zip and placed it in C:\gradle\bin I have also set my Environment Variables to GRADLE_HOME = C:\gradle and Path to C:\gradle\bin
I then restarted my Android Studio, It still doesn't work.
Please any help is appreciated. Thanks

just install JDK form oracle's website then install android studio,it will work , after installing java ,add JAVA_HOME to your environment path

Related

I have installed Android Studio but powershell can't find Gradle and Java

[enter image description here][1]I am new to app development. I have recently installed Android Studio.
When I try to run my app it shows error 1. I have tried "gradle --version" and
"java --version" commands but powershell does not recognize gradle and java. Should I install gradle and separately? Because I can't find their exe files in the android studio installation folder.
if java --version is not working then that means java is not in path find the JDK in your file structure and add it to your path (must look something like this C:\Program Files\Java\jdk-11.0.8\bin) then create a new environment variable JAVA_HOME and and add path as C:\Program Files\Java\jdk-11.0.8 (depends on your PC and where you installed it) after this uninstall and reinstall android studio also you cant just access gradel with command line its not installed in you PC also its not required there is a gradel file and gradel is inbuilt in android studio, just add java to path and reinstall android studio

JAVA_HOME is set to an invalid directory Android Studio (Flutter)

I am using OSX Yosemite on my old mac. When I installed emulator and try to create a run a Flutter project, I started getting an error about JDK 17. I deleted JDK 17 and installed JDK and also set my path in bash profile to "Library/Java/JavaVirtualMachines/jdk-1.8.0_321.jdk/Contents/Home". However, my Android studio is still giving this error.
ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
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
I spent hours solving this. Please help me. Thank you very much.
For Windows:
The problem is because of trace of old Android Studio java folder, just delete this folder and it starts working:
C:\Program Files\Android\Android Studio\jre
The new Android Studio Electric Eel is using jbr, not jre.
For macOS:
If you are using macOS replace the path in .bash_profile or .zshrc
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
with
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
I resolved the issue. Problem was due to 2 versions of Android Studio installed on same device. One was in applications folder and other was in Downloads folder. I was using Android Studio in Downloads folder and it's installation files are referring to old JDK plugin that was set for another Android Studio because both have similar paths.
/Applications/AndroidStudio.app/Contents/plugins/java/lib/jdkAnnotations.jar
After deleting old Android Studio and moving other one into Application folder resolved my issue. Thanks everybody for helping me out.

Ionic 4, Android Studio, Gradle, Java jdk or Cordova error

I am trying to test if the qr-scanner for my Ionic 4 app is working so I need to test my application on an android device (tablet).
I used the command: ionic cordova run android in my Visual Studio Code command prompt but I keep getting errors. My latest error is:
cordova.cmd run android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Me\AppData\Local\Android\Sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd run android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have downloaded/installed and configured Android Studio, Java jdk, Gradle and Cordova as all the solutions I have tried suggests but I keep getting more errors as I progress. Even after setting the user environmental variable ANDROID_HOME and system environmental variable PATH and restarting my computer.
Your problem is most likely that you are not running your Visual Studio Code as Admin.
So it cannot access the displayed paths.
Regards,
Markus

Phonegap Build Error: Failed to run "javac -version", make sure that you have a JDK installed

running:
phonegap build android
with android SDK and Java SDK installed, I get the following error:
Error: Failed to run "javac -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
I have tried adding the "java\jdk-9\bin" to environment variables, and PATH, etc. No luck!
My suspicion is that phonegap is trying to use the runtime version of Java as opposed to the SDK.
I had this problem and I solved it by uninstalling jdk-9 and installing JDK version 8.
Then set up the environment variables where needed (JAVA_HOME & add \bin to Path)
Maybe other users find this info useful. I'm windows user.
I spent so much time on this issue and realized that git-bash can't get it work and command prompt launch it without any issue! Many things i have did before switched to command prompt.
update to latest JDK8 Update
add \bin to Path.

jdk not found while installing android studio

I have installed jdk for 64 bit but still when I start installing android studio, it shows JDK not found or browse the path where it is installed. I browse
C:\Program Files\Java\jdk1.8.0_40 but then also it shows error this not we are looking to proceed.
Maybe there is no permission to android studio installation process to access the path where the JDK is installed. Try to run the installation as administrator.
Open the command line and run:
SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_40"
SET PATH=$PATH:"C:\Program Files\Java\jdk1.8.0_40\bin"
Regards

Categories

Resources