adb.exe is not executable. ANDROID_HOME is not set - android

I am successful in taking snapshot and open a activity using monkeyrunner. But what I want is to press a Button. So I am using ViewClient, but whenever I run my jython script the error comes:
File "F:\Example\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 870, in _init_()
File "F:\Example\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 986 in _ViewClient_obtainAdbPath
raises exception
('adb="%s" is not executable. Did you forget to set ANDROID_HOME in the environment?' %adb)
Exception: adb="%s" is not executable. Did you forget to set ANDROID_HOME in the environment?
Thanks in Advance

What OS are you using? Well, depending on your OS, you need to tell it where your Android SDK is located. For example, in Ubuntu machine, I have the following line in my .bashrc:
ANDROID_HOME=/home/roberto/android-sdk-linux/tools:/home/roberto/android-sdk-linux/platform-tools
export ANDROID_HOME
PATH=$PATH:$ANDROID_HOME
export PATH
If you are on a Windows machine, then you need to add this path to your Windows Environment's PATH.

set ANDROID_HOME=c:\Users\Administrator\AppData\Local\Android\android-sdk
Or any other place where you put Android SDK in your installation.
Replace 'Administrator' with your local Windows username (based on locale).
Tested on MS Windows 7 x64 Ultimate with Russian locale
and JAVA/JRuby versions:
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
and
jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit Server VM 25.51
-b03 on 1.8.0_51-b16 +jit [Windows 7-amd64]
io/console not supported; tty will not be manipulated
NameError: undefined local variable or method `rsion' for main:Object
<top> at -e:1

Related

Android Studio , on windows : JAVA_HOME is not set and no 'java' command could be found in your PATH

I am trying to build my Android app on the command line using Gradle commands. On executing the .gradlew build I am getting the error below:
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.
but I think I have already set the JAVA_HOME Path. If I echo %JAVA_HOME% in a separate cmd.exe window I get:
C:\Program Files\Android\Android Studio\jre
I have to point the JAVA_HOME to the JRE provided by Android and not the system Java, right?
Also, when I run the java command, it shows
'java' is not recognized as an internal or external command, operable program or a batch file
java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) Client VM (build 25.271-b09, mixed mode, sharing)
Please clarify?
PATH environment variable must indicate to the \bin directory of your JAVA_HOME, for example they should look like this:
JAVA_HOME: "C:\Program Files\Java\jdk1.8.0_301"
PATH: "C:\Program Files\Java\jdk1.8.0_301\bin"
Note that the PATH variable has other values too and you must append your value to it.
I understood your problem, add your JDK (Not JRE) path to the PATH variable in environment variables. Then run the java command, and it should run. And whenever you post a question, please do make sure that you mention details like what happens when you run java command :)

configuration jdk in android studio with ubuntu 17.10 not found java home

When I open Android studio, I am getting the following error:
java_home not found
My configuration :
Android Studio 3.0
Ubuntu 17.10 Gnome
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
I ran: sudo apt-get install oracle-java8-set-default
(and installed to /usr/lib/jvm/jdk1.8.0/)
I edited "/etc/environment" and set JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
And added the following lines to "/home/faiberts/.bashrc" and "/root/.bashrc":
export JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
export PATH=$JAVA_HOME/bin:$PATH"
Do I have some error in some step or it is necessary to change some configuration because I am confused since this is my first time trying to do development in android.
Thank you in advance for your valuable help.

cordova platform add android JAVA_HOME error in Ubuntu

I'm trying to start android development with Cordova on Ubuntu.
I can't add android platform for my project:
$ sudo cordova platform add android
Checking Android requirements...
[Error: ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.]
Environment checks:
$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on May 18 2012
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/programs/adt-bundle/sdk/platform-tools:/programs/adt-bundle/sdk/tools
$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.7.0_45
Eclipse ADT-Boundle is in /programs/adt-boundle folder
Please, tell me, why am I still getting this error?
[Error: ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.]
This got rid of the JAVA_HOME error for me:
~/.bashrc file:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
I also had to add:
export PATH=~/path/where/I/put/bundle/adt-bundle-linux-x86-20131030/sdk/tools
export PATH=~/path/where/I/put/bundle/adt-bundle-linux-x86-20131030/sdk/platform-tools
to get past another error
The error is simlar in Mac
I'm same bug
Checking Android requirements...
[Error: ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.]
https://issues.apache.org/jira/browse/CB-5422
After few days I tried cordova platform add android again and it worked good. Wery strange. I changed nothing.

draw9patch just hangs on Mac 10.7.5

draw9patch just hangs on my Mac 10.7.5. I have reinstalled the android-sdk-macosx.
In the directory android-sdk-macosx/tools I entered ./draw9patch and it is starting up, but then hanging with a white screen?
I have tried to go to the tools/lib directory and run
java -jar draw9patch.jar
with the same result.
Java:
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-11M4508)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-456, mixed mode)
Dump:
https://gist.github.com/powder366/5973285
https://gist.github.com/powder366/5973275
https://gist.github.com/powder366/5973228
Have anyone seen this? Suggestion on how to find the problem?
Update with this Java patch http://support.apple.com/kb/DL1572 also see here https://code.google.com/p/android/issues/detail?id=57473&can=1&q=draw9patch&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
From the script I can see this comment:
# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
# might need more memory, e.g. -Xmx128M
but anyway both command work for me:
java -Djava.ext.dirs=. -jar draw9patch.jar
java -jar draw9patch.jar
Probably you have a failing jar. Can you try with mine?
[I'm on a Mac running Mountain Lion 10.8.4 but I had no problem with Lion 10.7.5]

How to build android project with openjdk on Ubuntu?

I found this Is Sun Java really necessary for using Android SDK on Ubuntu 10.10? I prefer OpenJDK but I can't build android project on Ubuntu. When I try:
$ ant debug
I got:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
...
BUILD FAILED
/home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:651: The following error occurred while executing this line:
/home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:672: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"
I have java version:
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.10.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
Make sure you have the openjdk JDK installed. By default you probably only have the JRE installed. If you open Synaptic, search for openjdk and then you'll see both the JDK and the JRE. Select the JDK package and install. I think the actual packagename is openjdk-6-jdk.
or use the commandline
# sudo apt-get install openjdk-6-jdk
Android's official webpage reccomends the use of the official JDK from Sun/Oracle that you can download at http://www.oracle.com/technetwork/java/javase/downloads/index.html , the use of OpenJDK is unsupported and highly unrecommended.
You don't need to install the official JDK in your system, if this is what you are worring about, just download the *.bin version of the JDK of your choice ( i suggest the 1.6 version ), unpack everything by executing the *.bin in a terminal, and just modify 2 environment variable like this:
PATH , add the path to the jdk executables path_to_jdk/bin/ to your PATH
JAVA_HOME , set JAVA_HOME to the generic path of your jdk, NOT the bin or lib path, just as before without bin, only path_to_jdk/
you can modify this variables by editing the /etc/bash.bashrc or your local .bashrc, I suggest to edit the one under /etc
you also want to remove your actual OpenJDK from your system.
I've fixed same error (in Debian/Ubuntu) by installing gcj-jdk.
Before installing this package i had java-7-openjdk, but no tools.jar inside its directory.
After installing gcj-jdk I've located tools.jar and made a symlink to it inside directory where ant wants it to be.

Categories

Resources