3

I'm trying to set up the android-sdk but the sdkmanager won't show up.

because of this Error massage i cheked my JAVA_HOME variable, witch is pointing correctly to the jdk instalation:

if i run

echo %JAVA_HOME%

in cmd i get

C:\Program Files\Java\jdk-10.0.1

this is the output of android.bat

C:\Android\sdk\tools>android.bat

ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
  http://www.oracle.com/technetwork/java/javase/downloads

If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.

You can find the complete Android SDK requirements here:
  http://developer.android.com/sdk/requirements.html


C:\Android\sdk\tools>
2

4 Answers 4

2

If java downgrade didn't work for you try this

After long struggle I was able to figure out the issue, Not sure if this is a valid fix but that did fix it.

In the latest Android studio version 3.4 in
C:\Users\username\AppData\Local\Android\Sdk\tools\lib\find_java.bat on line 44 it looks like this

 for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%a% 

if you give

echo of %~dps0\find_java%arch_ext%.exe

this line it is supposed to print the path of the find_java32.exe or find_java64.exe based on your machine architecture but it adds // slashes in the path just before final finde_javax.exe which was causing an issue.

so I just modified it to look like below and it worked.

" for /f "delims=" %%a in ('"%~dps0%find_java%arch_ext%.exe" -s') do set java_exe=%a% "

Do let me know if there is a better solution or if this works for you

1

@Saravinfotech's answer didn't work for me but it pointed me at the right place. The double \ still called find_java64.exe for me, but running that:

$ .\find_java64.exe -e
Failed to find Java 1.6 (or newer) on your system. [2] The system cannot find the file specified.

Even though java.exe was on my path and JAVA_HOME was set to my oraclejdk\current folder. Not worth debugging though.

I just patched the script with these additions:

set java_exe=%JAVA_HOME%\bin\java.exe

set javaw_exe=%JAVA_HOME%\bin\javaw.exe

and the script stopped complaining.


Looking back, there might be bigger problems going on. monkeyrunner.bat is calling java.exe with arg-Djava.ext.dirs instead of -classpath which isn't supported as of JDK9 (?), and even working around that, I'm getting NoClassDefFoundError. A recent release of Java 14 seems very incompatible.

Installing JDK8 was the fix.

1

Found a solution which DON'T NEED ONE TO DOWNGRADE TO JAVA 8 so, there is option for JRE to run VM for "uiautomatorviewer".

One needs to install Android Studio and add the below location to "path" System Variable

C:\Program Files\Android\Android Studio\jre\bin

I have jdk-11.0.6 and "uiautomatorviewer" is working fine.

1
  • I installed jdk16 and even i was getting the same error. but adding the jre path and moving this path to top helped me fix the issue Apr 30, 2021 at 6:04
0

What worked for me is installing Java 8 and changing all java paths to the Java directory (C:\Program Files\Java\jre-1.8) and Setting JAVA_HOME environment variable. Other answers did not work for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.