I am trying to write a script to automate my build process and push builds every so often. So ever everything seems to be working except for my JAVA_HOME environment variable.
When building the app normally from command line I specify my JAVA_HOME as:
/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
However if I add this as an environment variable to my launchctl.plist I get the following error:
ERROR: JAVA_HOME is set to an invalid directory: /Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
This directory does exist and works fine when building the app normally.
If I do not specify the JAVA_HOME then I get the following error on building my app:
General error during semantic analysis: Unsupported class file major version 60.
Is there something I am doing wrong or can change to allow launchd to either build without the specified JAVA_HOME or to recognize the JAVA_HOME I am setting?
Add the code below to your environment's path .zshenv file in your home directory.
Run source ~/.zshenv to update terminal or Quit the terminal and reopen it again
Android Studio Dolphin and below:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
Android Studio Electric Eel and above:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
After clean install of Android Studio I always get the error
Error:java.util.concurrent.ExecutionException:
java.lang.RuntimeException: No server to serve request. Check logs for
details.
and
Error:Execution failed for task ':Application:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
Java is up to date and the path is set.
I am new to Android Studio, what should I try?
We ran into the same issue, and have been able to find the root cause: The error message means that Gradle cannot connect to some worker processes. In our case, the process was for 'aapt2'. Running 'ldd aapt2' indicated that some shared libraries were missing (mainly GLIBC). Since we're using Docker based on Alpine Linux, it comes with a reduced GLIBC (glibc-musl). The solution was to simply install glibc in the Docker container.
I suggest you run ldd build-tools/{version}/aapt2
to see which libraries are missing from the OS. You did not mention your OS, are you also using Docker and AlpineLinux ?
In my case, I did not need to re-download the sdk. I closed Android Studio and ran the following command in the Terminal:
sudo chmod 777 -R ~/Desktop/AndroidStudio
...where, ~/Desktop/AndroidStudio was the folder structure after Root which I needed to mention in order to provide permission to read all the SDK packages and perform required operation as and when necessary by the Android Studio, because my Sdk folder was inside "~/Desktop/AndroidStudio".
I am running Android Studio 3.0.1 on Ubuntu 16.04 LTS. This worked for me perfectly :-)
This error occurred because you might have accidentally remove the executable flag from aapt2 which is located in $ANDROID_HOME/build-tools/27.0.2.
Try this:
Re-download the sdk (recommended)
followed by-
sudo chmod 777 -R $ANDROID_HOME
Note:
$ANDROID_HOME is the location where I put android sdk
Hope this helps !!
Had to uninstall Android studio and delete the following
SDK folder in AppData folder
Delete .gradle folder
delete .AndroidStudio Projects folder
and did a fresh install which solved .
I had this problem on lubuntu-16 32bit (and also some other problems too). all of the problems were solved when I updated my system to lubuntu-16 64-bit.
Here how I fixed this Issue:
1.Deleted .gradle folder.
2.Closed android studio and run as administrator.
On Start android studio will rebuild the folder you deleted.
sudo chmod 777 -R $ANDROID_HOME
Note: $ANDROID_HOME is the location where you put android sdk
Hope this helps !!
If it is possible for you, please delete the build folder of project and test building android project with any other version of build-tools.
in my case, build-tools version: 26.0.2 had problem, I tested with 27.0.3 and it solved my problem unbelievably :)
I ran into the same problem, and it turned out I had messed up the file permissions inside the android-sdk folder (more specifically android-sdk/build-tools/{version}), and some binaries were missing execution permissions.
In my case, I simply gave x permissions to the relevant files in that directory, but if you're not sure, I suggest you uninstall the android sdk, completely remove its directory and then reinstall it again.
So after investigating the issue for long , I have a concrete solution .
Let`s look into it.
Go to Android Studio -> Help -> Show Log In Files
In the subsequent folder that opens, open idea.log
This would present you with a log file which contains logs of processes right from when the studio started. Now in this file, you have to search for the possible issue. For some the issue might be due to
java.io.IOException: Cannot run program "/home/mmt/Android-Sdk/android-sdk-linux_x86/emulator/emulator-check": error=13, Permission denied
For some others, it may be some other. The point is that this file contains lot of irrelevant logs and you have to identify the one that is causing this issue. For me , after discovering the above issue, I granted permission to that particular folder using the below commands
cd $ANDROID_HOME/sudo chmod -R 777 emulator/
After this, rebuild your project and tadaaa.. problem resolved.
for me it was a virus that corrupted my files from the "build tools" folder. so I uninstalled everything and made a new installation of android studio, SDK and build tools.
For me, this is the side effect of another issue that I haven't root caused yet. Every once in a while, I get aapt2 failures because some file /tmp/ld-linux-x86-64.so.2 is "busy", with the following error message.
AAPT err(Facade for 1745790725): cp: cannot create regular file '/tmp/ld-linux-x86-64.so.2': Text file busy
Slave 1745790725 failed to start java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at ~/.../android-sdk-linux/build-tools/27.0.3/aapt2) are not corrupted.
When this happens I just rm that file and everything starts working again. I suspect this might be caused by me actually having two installs of adb (one through ubuntu via apt and one from Android studio) but I haven't had time to dive deeper.
I already had latest version of build-tool installed, so I just had to give permission to Android_home:
chmod 777 -R $ANDROID_HOME
and build again. This worked for me.
If you are on Windows 10 (sigh), close android studio and then right click on android studio icon and select 'Run as Administrator' from 'more' menu.
Build again.
You can run Android Studio as Admin.
I hope it will help you.
To Do So :
Right click
choose Run as Administrator
Best regards,
I am unable to Install ANT, but i get install GIT, so i make a Folder in C Drive and paste the ANT unzipped files.
I have following location of installations,
1) JAVA: <D:\jdk1.7\bin>
2) GIT : <C:\Program Files\Git\bin>
AND
3) i created a Folder in C Drive for ANT : <C:\ant\bin>
Using Command prompt ,
i can execute the the command git , successfully . But when i put command ant, gives the following error
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
My environment variable set to the following path,
ANT_HOME = <c:\ant\bin>
JAVA_HOME = <d:\jdk1.7\bin>
Path = <%PATH%;%ANT_HOME%\bin;>
That's all , Thanks.
According to the information you provided, PATH variable should look like following:
%JAVA_HOME% ; %ANT_HOME% ; <other entries>
It seems that you're using Windows, thus you should check both your user-scope and system-scope environment variables (Computer - Properties - Advanced System Settings - Environment Variables).
Currently your build is failing due to JRE-related entry in PATH variable. Please remove it and retry.
Easiest way to check that the issue is resolved is to execute this from your command line:
javac -version
Normally this will give output like following:
javac 1.7.0_40
Install java and add it to class path by either creating java_home or directly to path variable in windows. Do the same thing for ant too. ie) place the ant location[upto ant\bin] in path variable and open the command prompt type ant . you will get the output as build failed which expects build.xml. Same will be applicable for git and other utilities...
hope it helps
i got the solution, Just download the project given in the link below ,
http://www.java2s.com/Open-Source/Java_Free_Code/Image/Download_Volley_demo_Free_Java_Code.htm
And import using Eclipse, and RUN. That's all . no need to make git reference. ( if you getting error continuously )
volley.jar you can use in your custom projects also.
executing
:ProjectCreate /path -n android
gives
java.lang.RuntimeException: no command android list targets found
while executing command (port: 9091): -editor vim -command android_list_targets
The problem is that is telling you the android command is not found, what you need to do (you're already solved it but for other readers...) is:
Be sure you have downloaded the android-sdk and path is properly setup (when installing eclim it ask for its path but you can also change it in your .vimrc).
Be sure 'android' command is available in your system, i.e loaded in your path. (in linux you can type in a terminal "which android" to see if android cmd can be found).
Good luck!
I have installed PhoneGap via command prompt. I have installed java, ADT and Apache ANT and setup their environment variables as follows:
ANDROID_HOME - C:\Program Files\ADT\adt-bundle-windows-x86_64\sdk\platform-tools
ANT_HOME - C:\Users\myname\Downloads\apache-ant-1.9.3-bin\apache-ant-1.9.3
JAVA_HOME - C:\Program Files\Java\jdk1.7.0_51
When I use command prompt to check on Java via the commands java or javac, I get a list of print out which I believe indicates that it is working.
Similarly when I try to type ant, it is not recognized which I am assuming is the problem. I did look through past questions here from which I have come to the current setup and it is still not working.
When I go into the created PhoneGap project folder and input the command:
phonegap run android
It returns the following error message:
An error occurred during the creation of android sub-project.
Please advice what I am doing wrong. Thanks.
Edit:
adb - it prints out a long list
android - The system cannot find the path specified
Failed to create c:/Program Files/ADT/sdk/add-ons
Error: unable to parse SDK content.
android is returning error as above. I checked the path and it is
correct less the last part. I don't have a folder called add-ons
inside sdk folder.