I'm trying to compile a project in android studio and it gives the
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
I've already red that to gather more information i should use:
gradlew compileDebug --stacktrace
from the main folder, but when i do that i get that error:
JAVA_HOME is set toan invalid directory: C:\Program Files (x86)\Java\Jre7\bin\java.exe;
Please note that i tried to use a 64 bit version of the jre too in the JAVA_HOME path.
Anyone can give me some help ?
Thanks in advance
Change the value of environment variable JAVA_HOME to C:\Program Files (x86)\Java\Jre7\ instead of C:\Program Files (x86)\Java\Jre7\bin\java.exe
JAVA_HOME should be always pointing to the parent directory of JDK or JRE installation inside of which, we find the bin directory containing the java, javac, etc. binaries
I might be reading too much into the error message, but shouldn't JAVA_HOME look more like C:\views\p4\library\bea-jrockit\1.6.0_29\windows-x86_64\dist?
Notice that it points to a folder called 'dist' instead of to the java.exe itself. To help you figure out the folder, 'dist' has inside of it 'bin'. So maybe try something more like C:\Program Files (x86)\Java\Jre7\?
Related
I had to install an updated version of Java RE. My installed version of eclipse complained that it couldn't find it. This eclipse came with a complete ADT download. The specific error message was that it couldn't find javaw.exe in the eclipse\jre\bin sub-directory of the adt-bundle directory. I copied javaw.exe to that sub directory. This time Eclipse tried to start, but came back with an Error code 13 and a long list of stuff that wasn't very enlightening. Please help.
just reinstall JDK 32/64-bit, re-extact eclipse-32/64bit and edit eclipse.ini again
Check your eclipse.ini file and see if following required are well written :
Note:
the format of the -vm option - it is important to be exact:
1. The -vm option and its value (the path) must be on separate lines.
2. The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
3. The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
Check this link for reference.
And also this link
Hope this will help.
Make sure to download JDK and JRE from:-
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Also create PATH enviroment variable on you computer like this:
Right click on My Computer > Properties > Advanced > Enviroment variables > New ( Variable name: PATH Variable value : C:\Program Files\Java\jdk1.7.0_06\bin (Where you installed Java)) > Click OK! Done
I hope this helps. Good luck!
I downloaded the JDK again and re-installed it and re-transferred the javaw.exe to the sub directory where Eclipse wanted it (...\eclipse\jre\bin) and it worked fine. My previous download of the JDK must have been somehow corrupted
I have seen this same thing posted quite a few times, but whenever I try to import my project to my new work laptop I keep getting this error.
I have pulled the project from git (which his btw running fine on my old laptop).
Then I went to the sdk manager, downloaded all the tools, and all the SDK's available.
In the welcome screen, I went to Configure -> project Defaults -> Project structure.
Android SDK Tab says the path for projects without local.properties will be /Applications/Android Studio.app/sdk
This is correct.
Under SDKs I have all the available SDK's visible.
Project SDK is set to API 18
Yet still I get this error when trying to build my project.
Can anyone tell me where I havent looked yet?
I am running gradle 1.7 when trying to build which is downloaded from services.gradle.org
I had very similar situation (had a project on another machine and cloned it to my laptop and saw the same issue) and I looked in it.
Error message was coming from Sdk.groovy of Android gradle plugin:
https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy
By looking at code, its findLocation needs to set androidSdkDir variable and there are only three ways to do it:
create local.properties file and have either sdk.dir or android.dir line.
have ANDROID_HOME environment variable defined.
System.getProperty("android.home") - I'm not sure how it works, but it seems like a Java thing.
While your Android Studio knows that the SDK is at that place, I doubt that Android Studio is passing that information to gradle and thus we're seeing that error.
I created local.properties file at the project root and put the following line and it compiled the code successfully.
sdk.dir = /Applications/Android Studio.app/sdk/
creating local.properties file in the root directory solved my issue
I somehow lost this file after pulling from GitHub
this is how my local.properties file looks like now:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Feb 06 11:53:03 EST 2016
sdk.dir=/Users/****/Library/Android/sdk
I found the solution here:
http://xinyustudio.wordpress.com/2014/07/02/gradle-sdk-location-not-found-the-problem-and-solution/
Just create a file local.properties and add a line with sdk.dir=SDK_LOCATION
If none of the answers work for you which happened to me on macbook pro in one of the projects you can always try to run Android Studio with an alias command passing sdk.dir with each run:
alias studio='launchctl setenv ANDROID_HOME '\''/Users/username/Library/Android/sdk'\'' && open -a '\''Android Studio'\'''
To fix this problem, I had to define the ANDROID_HOME environment variable in the Windows OS.
To do this, I went to the System control panel.
I selected "Advanced system settings" in the left column.
On the "Advanced" tab, I selected "Environment Variables" at the bottom.
Here, I did not have an ANDROID_HOME variable defined. For this case, I selected "New..." and:
1) for "Variable name" I typed ANDROID_HOME,
2) for "Variable value", I typed the path to my SDK folder, e.g. "C:\...\AppData\Local\Android\sdk".
I then closed Android Studio and reopened, and everything worked.
Thanks to Dibish (https://stackoverflow.com/users/2244411/dibish) for one of his posts that gave me this idea.
Had the same problem in IntelliJ 12, even though I have ANDROID_HOME env variable it still gives the same error. I ended up creating local.properties file under the root of my project (my project has a main project w/ a few submodules in its own directories). This solved the error.
specifying sdk.dir=<SDK_PATH> in local.properties in root folder solved my problem.
I clone libgdx demo, can't import project. it also reminds like this.
Env:
Eclipse(Android-ADT)
window 7
so I create local.properties file at the project root, like following
sdk.dir = D:/adt-bundle-windows-x86/sdk
I hope this can help others!
Copy and paste the local.properties file from a project you created on your new computer to the folder containing the project from your old computer also works too if you don't want to (or know how to) create a new local.properties file.
I noticed that I get this error when I'm working on a new computer if I try to build from the command line first. However, if I build from Android Studio, it retrieves the SDK and creates the directory automatically. Then when I build from the command line it works.
You have also to ensure you have the correct SDK platform version installed in your environment by using SDK Manager.
If you have cloned a project from GitHub for example, and you've tried the methods mentioned here without success including:
Editing sdk.dir in the local.properties
Trying to set ANDROID_HOME environment variable
Or adding an alias as kasiara mentioned
You should try to see if you are trying to build a directory project that is a part within a bigger project, and so it may cause problems.
So load the entire project, and then run the project directory you'd like.
In my specific case I tried to create a React Native app using the react-native init installation process, when I encountered the discussed problem.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\***\android\local.properties'.
I add this, because when developing an android app using react native, the 'root directory' to which so many answers refer, is actually the root of the android folder (and not the project's root folder, where App.js resides). This is also made clear by the directory marked in the error message.
To solve it, just add a local.properties file to the android folder, and type:
sdk.dir=C:/Users/{user name}/AppData/Local/Android/Sdk
Be sure to add the local disk's reference ('C:/'), because it did not work otherwise in my case.
I have a problem about Unable to access jarfile ..\lib\proguard.jar when run Export Singed Application Package from IntelliJ 11.1.
Environment:
Run proguard is success in Android SDK r16.
Run proguard is failed in Android SDK r17.
The problem is IntelliJ setting error or IntelliJ 11 bug?
Edit $ANDROID_SDK\tools\proguard\bin\proguard.bat and set absolute path to PROGUARD_HOME
May look like this:
SET PROGUARD_HOME="c:\android-sdk\tools\proguard"
java -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
This issue can also come up if you have a space anywhere in your Android SDK path. The solution is to modify $ANDROID_SDK\tools\proguard\bin\proguard.sh. Change this last line:
java -jar $PROGUARD_HOME/lib/proguard.jar "$#"
to
java -jar "$PROGUARD_HOME/lib/proguard.jar" "$#"
On Mac:
/Applications/Android Studio.app/sdk/tools/proguard/bin/proguard.sh
Change this last line:
java -jar $PROGUARD_HOME/lib/proguard.jar "$#"
to
java -jar "$PROGUARD_HOME/lib/proguard.jar" "$#"
The reason why it happened for me on my Windows machine was because I moved the location of the Android SDK in my file system but I didn't update my PROGUARD_HOME system variable. The PROGUARD_HOME system variable is referenced in the {android-sdk}\tools\proguard\bin\project.bat file.
Extra Info:
The value of my PROGUARD_HOME system variable was set as a path within my old Android SDK directory. I shouldn't experience this in future because I've now created an ANDROID_HOME system variable which points to my Android SDK and my PROGUARD_HOME system variable is now defined as follows:
%ANDROID_HOME%\tools\proguard
All I have to do in future if I relocate my Android SDK in future is update my ANDROID_HOME system variable.
This issue has been occurred after I had updated tools (26.6.2)+ migrating to win7 from xp.
The possible reason perhaps in proguard place because some folders can have a space in their path folders' names(like "Program Files",e.g.).
In my case i did what has been pointed above but copied the entire proguard folder to new place (mine new became "c:\proguard") and put its path to PROGUARD_HOME
SET PROGUARD_HOME="c:\proguard"
in $ANDROID_SDK\tools\proguard\bin\proguard.bat file.
Another possible way:
After tools upgrading i found very simple solution:
find environment variable
PROGARD_HOME on windows
and edit its path to
(in mine case ,currently) :
not C:\Program Files\Android\android-sdk\tools\proguard
but "C:\Program Files\Android\android-sdk\tools\proguard"
I am trying to run the draw9patch.bat from my cmd but it throws the following error.
WARNING: Java not found in your path.
Checking if it's installed in C:\Program Files\Java instead (64-bit).
Checking if it's installed in C:\Program Files\Java instead.
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
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I have java installed and have also tried changing the classpath from environment variables in the control panel.However it does not seem to solve the problem.What am i doing wrong.
For that you need to set the 'path' environment variable.
Something like this:
path=%path%;c:\program files\java\jdk 1.6\bin
or
the path where you have installed the java.
You may need the swing-worker-1.1.jar, place this in Android-sdk/tools/lib directory.
For people who are looking for solution for Windows 7 (maybe for xp too) and that last answers wasn't the right solution.
If you have problem with running this file, this problem will happens in almost all .bat files in android-sdks/tools files.
Here is what to do and all that batch files will work okay.
I assume that you have downloaded proper JDK so..
Go to folder android-sdks\tools\lib and edit file find_java.bat
Delete all text stored inside and insert into something like that:
set java_exe="C:\Program Files\Java\jre7\bin\java.exe"
if not defined java_exe goto :CheckFailed
:SearchJavaW
set javaw_exe="C:\Program Files\Java\jre7\bin\javaw.exe"
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF
Please be carefull and put correct path to jre what you have! Here is an example for jre7!
I am trying to make ndk-build to work within Cygwin on windows. As per the NDK documentation (specifically INSTALL.htm), "The NDK requires GNU Make 3.81 or later being available on your development."
I have Gnu Make installed on my computer.
So far, so good.
Within Cygwin bash, I cd over to the android NDK root directory. Now when I type in the following command (without parameters right now, just to see if the command works):
$./ndk-build
ERROR: Cannot find 'make' program. Please install Cygwin make package or define the GNUMAKE variable to point to it.
So I try to set the GNUMAKE variable, but no luck:
$export GNUMAKE='/cygdrive/c\Program Files\GnuWin32\bin'
ERROR: Your GNUMAKE variable is defined to an invalid name: /cygdrive/c\Program Files\GnuWin32\bin
Please fix it to point to a valid make executable (e.g. usr/bin/make)
I even tried setting it to usr/bin/make as it suggests, but same invalid name error.
Anyone, knows how to resolve this?
I'm using Windows 7, NDK r5, Cygwin 1.7.1
I had an issue with GNUMake when putting the ndk in a folder with a space in it (I originally put it in the program files directory). I moved everything to C:/android/android-ndk and C:/android/android-sdk and updated my path settings to include these directories.
Its not problem with the make but installing cygwin
in ndk-demo script the make path is found using which command mostly which command
installation is missing in cygwin.
Solution:
Relaunch your cygwin installation select utils (install )
Checking:
$ which make
should give you the make command path on cygwin prompt.
Regards,
Vasu
This is a generic error. It means there was a problem somehow with the make command, but the error message itself is hidden. To help diagnose the problem, open your ndk_build script in the ndk directory, and change these lines:
ABS_GNUMAKE=`which $GNUMAKE 2> /dev/null`
...
GNUMAKE=`which make 2> /dev/null`
to these:
ABS_GNUMAKE=`which $GNUMAKE`
...
GNUMAKE=`which make`
And then you will get a more detailed error message. Note that it might not even be a problem with the 'make' command, it might be a problem with the 'which' command. Make sure you have cygwin installed.
delete Environmental variable GNUMAKE
close the cygwin terminal
open again cygwin terminal... go the path where u want to build.. and now build it...
I am sure hopefully you will build successfully..as i do..
The answer with moving NDK to a directory without spaces is definitely right. After that you will probably able to run ndk-build from the Cygwin shell.
However running ndk-build from Windows commmand line (like "bash ndk-build") will probably cause the same queer error with "incorrect GNU make".
It is reproducible with NDK 6b as well.
And I hope it is fixed in the newest version of NDK...
ERROR: Cannot find 'make' program. Please install Cygwin make package
or define the GNUMAKE variable to point to it.
While trying to install Cygwin i missed out to install MAKE PACKAGE
Just need to search make in the Search box and it will shows the Branches that includes devel branch and from devel branch i selected make package.
That's all issue fixed.
i worked hard on error in gygwin terminal "gnumake variable is define to invalid name" and after that i get to the point that we simply remove this error by deleting the GNUMAKE path in environment variable both in system and user variable if u created it hope its helps....
mycomputer > system properties > advanced system setting > environment variable
The problem here is the name of the GNUMAKE variable.The name given was
/cygdrive/c\Program Files\GnuWin32\bin change it into /cygdrive/c/Program Files/GnuWin32/bin/make
only use forword Slash .Sometime the space in the folder structure does not taken
Happy coding.