I am not able to execute the sdkmanager from command line. if I execute ./sdkmanager --list, I got following exception
Error: Could not find or load main class java.se.ee
Any help on this?
I have solved my issue by removing -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee in the sdkmanager
It was originally
# Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
and I removed -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee.
Now I can run sdkmanager commands
Related
I'm trying to use Jenkins with my Flutter project, however, when I build the project I get the following error
flutter command not found.
I have added the following code in the .bash_profile
export PATH=$PATH/Users/andrey/Developer/flutter/bin
I also have added the following in the Global properties:
Name:ANDROID_HOME
Value:/Users/andrey/Library/Android/sdk
Name:HOME
Value:/Users/andrey
Name:PATH
Value:/$PATH/Users/andrey/Developer/flutter/bin
I have the following shell script
#!/bin/sh
flutter build apk--debug
flutter test
The reason that it was failing is because the PATH variable was not exactly the same as when the echo $PATH was being inputed in the terminal.
I am trying to install the sdk manager alone for using it with Eclipse. I downloaded the zip file provided by google -
commandlinetools-win-6200805_latest.zip
from https://developer.android.com/studio
But as I try to run the sdkmanager.bat file it doesn't run and i am getting the following errors:
Error: could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
Please note that Java jdk path is set properly and there is no error with respect to that.
If you are interested to look at the bat file, here it is:
#if "%DEBUG%" == "" #echo off
#rem ##########################################################################
#rem
#rem sdkmanager startup script for Windows
#rem
#rem ##########################################################################
#rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..
#rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dcom.android.sdklib.toolsdir=%~dp0\..
#rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
#rem set JAVA_EXE=C:/Program Files/Java/jdk1.8.0_241/bin/java.exe
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
#rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
#rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
#rem Setup the command line
set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
#rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%
:end
#rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable SDKMANAGER_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%SDKMANAGER_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Any help appreciated
TL;DR;
copy the content of tools/lib/_ to tools/lib
run sdkmanager commands with --sdk_root parameter.
Details
In the line 66 of the sdkmanager.bat, CLASSPATH is defined to be like this
set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
and inside the lib directory, sdkmanager-classpath.jar is, oddly, under a subdirectory called -.
I tried to change the path in the batch file but it did not work, so I copied the files from ..../tools/lib/_ to ..../tools/lib and the error disappeard. However, a warning appeared:
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
According to this answer, I tried to pass the --sdk_root parameter which worked without problems:
sdkmanager --sdk_root=%ANDROID_HOME% --list
# %ANDROID_HOME% is the environment variable that contains the path of android
# sdk installation. Typically, would be:
# `C:\Users\<USERNAME>\AppData\Local\Android\Sdk\tools`
PS: even I was able to solve this, I would say that this answer is a workaround since the documentation does not mention anything about copying files to other path
I post this for my short note upon the solution.
After done several research only specify sdk_root parameter solve Java problem.
sdkmanager --sdk_root=%ANDROID_HOME% --install [Package_name]
Where %ANDROID_HOME% specify a PATH to android SDK extracted. e.g. "d:\android-sdk"
Package_name can be obtained from --list option.
sdkmanager --sdk_root=%ANDROID_HOME% --list
I use this for Appium so only platform-tools, platforms [API Level] Should be fine. Emulator if you want to use AVD.
I also had the same problem and did not get any solution and one day by mistake I got the solution.
At first I kept the SDK folder wherever I wanted but this gave the error, so I kept it in the AppData folder (in Windows)
C:/Users/{username}/AppData
This folder is hidden by default, so either search for it in the address bar or enable to show the hidden folder and keep the SDK folder there
I am trying to install the sdk manager alone for using it with Eclipse. I downloaded the zip file provided by google -
commandlinetools-win-6200805_latest.zip
from https://developer.android.com/studio
But as I try to run the sdkmanager.bat file it doesn't run and i am getting the following errors:
Error: could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
Please note that Java jdk path is set properly and there is no error with respect to that.
If you are interested to look at the bat file, here it is:
#if "%DEBUG%" == "" #echo off
#rem ##########################################################################
#rem
#rem sdkmanager startup script for Windows
#rem
#rem ##########################################################################
#rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..
#rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dcom.android.sdklib.toolsdir=%~dp0\..
#rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
#rem set JAVA_EXE=C:/Program Files/Java/jdk1.8.0_241/bin/java.exe
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
#rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
#rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
#rem Setup the command line
set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
#rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%
:end
#rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable SDKMANAGER_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%SDKMANAGER_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Any help appreciated
TL;DR;
copy the content of tools/lib/_ to tools/lib
run sdkmanager commands with --sdk_root parameter.
Details
In the line 66 of the sdkmanager.bat, CLASSPATH is defined to be like this
set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
and inside the lib directory, sdkmanager-classpath.jar is, oddly, under a subdirectory called -.
I tried to change the path in the batch file but it did not work, so I copied the files from ..../tools/lib/_ to ..../tools/lib and the error disappeard. However, a warning appeared:
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
According to this answer, I tried to pass the --sdk_root parameter which worked without problems:
sdkmanager --sdk_root=%ANDROID_HOME% --list
# %ANDROID_HOME% is the environment variable that contains the path of android
# sdk installation. Typically, would be:
# `C:\Users\<USERNAME>\AppData\Local\Android\Sdk\tools`
PS: even I was able to solve this, I would say that this answer is a workaround since the documentation does not mention anything about copying files to other path
I post this for my short note upon the solution.
After done several research only specify sdk_root parameter solve Java problem.
sdkmanager --sdk_root=%ANDROID_HOME% --install [Package_name]
Where %ANDROID_HOME% specify a PATH to android SDK extracted. e.g. "d:\android-sdk"
Package_name can be obtained from --list option.
sdkmanager --sdk_root=%ANDROID_HOME% --list
I use this for Appium so only platform-tools, platforms [API Level] Should be fine. Emulator if you want to use AVD.
I also had the same problem and did not get any solution and one day by mistake I got the solution.
At first I kept the SDK folder wherever I wanted but this gave the error, so I kept it in the AppData folder (in Windows)
C:/Users/{username}/AppData
This folder is hidden by default, so either search for it in the address bar or enable to show the hidden folder and keep the SDK folder there
I want to generate lint report for my project.
So on my Ubuntu terminal I gave the command lint my_prj_path
but I'm getting below error,
No command 'lint' found, did you mean:
Command 'link' from package 'coreutils' (main)
Command 'jlint' from package 'jlint' (universe)
Command 'hlint' from package 'hlint' (universe)
Command 'line' from package 'util-linux' (main)
Command 'tint' from package 'tint' (universe)
Command 'dlint' from package 'dlint' (universe)
lint: command not found
May be its very basic question, but I can't find a solution. Please help.
Thanks in advance.
lint is available into /sdk/tools/. So you need to go to directory or add relative path before lint command, like
SDK_PATH/sdk/tools/lint project_path
I made it that way:
Firstly, check that your .bash_profile file contains ANDROID_SDK_ROOT path]
Secondly, add lint() function:
function lint() {
cd $ANDROID_SDK_ROOT/tools/bin;
./lint $1;
}
Now you can call lint commands via terminal, for example, lint --list
On Ubuntu, navigate to android sdk tools directory and down to binaries $ANDROID_ROOT/sdk/tools/bin. Then call
./lint [flags] <project directory>
(note a call to ./lint not just lint)
For example, to get a list of all lint-supported issues call:
./lint --list
i am trying to install Phonegap on Ubuntu 13.04, i have installed the Android SDK with all available Packages, but running the following command:
cordova platform add android
fails with an unexpected error:
[Error: An error occured during creation of android sub-project. An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &>/dev/null exited with 1
Deleting project...
I have set the PATH Variables for Android (tools / platform-tools) and java and ant are installed.
Why does this happen? How can i get a more detailed error message?
have you tried running command with sudo?
it could be a permissions issue.
If still not working, try running it using verbose mode i.e. sudo -d cordova...
In case this is due to activity name whitespaces, see comments for this answer.
There is an issue reported in https://issues.apache.org/jira/browse/CB-4198, for which I've sent a pull request to remove whitespaces https://github.com/phonegap/phonegap/pull/39.
As #José said, the "hello" example doesn't work because spaces are not allowed.
Changing it to "HelloWorld" solves the problem.
remove the space in between name tags in config.xml
MyAppName< name>
In my case, using debian wheezy, the example from: http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface does not work with this error:
[Error: An error occured during creation of android sub-project. An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &>/dev/null exited with 1
Deleting project...
]
After adding $JAVA_HOME (Java sun, with openjdk did't work) and $PATH the andriod sdk path to .../sdk/platform-tools:../sdk/tool
The solution in my case was the project name:
The example that doesn't work:
cordova create HelloWorld com.example.hello "Hello World"
THIS works:
cordova create HelloWorld com.example.hello HelloWorld
Make sure your package and project names are correct, following the com.mycompanyname.myappname format without any numbers or dashes.
Here's the issue being tracked by PhoneGap.
If you open up the create file (phonegap-2.7.0/lib/android/bin/create) with textEdit, there is a line that lists
ANDROID_BIN=”${ANDROID_BIN:=$( which android )}”.
The “which android” is the cause of the issue
If you replace this line with the full path to your android tools (SDK), it should resolve the issue. It looked like this:
ANDROID_BIN=/Users/cswjs/Documents/Dev/adt-bundle/sdk/tools/android
OR try modify ~/.bash_profile using open ~/.bash_profile to full PATH
export PATH=${PATH}:/Users/cswjs/Documents/Dev/adt-bundle/sdk/platform-tools:/Users/cswjs/Documents/Dev/adt-bundle/sdk/tools
And use cordova create foo com.example.foo foo to create new project named foo. Make sure project name should be same.
Hope this could help someone!
IN my case there are many places in create script where u need to remove >null to see real logs. and i finally resolved my issues by
sudo chown -R sachinsharma ~/.cordova