I am developing a java application on MAC OSX which communicates with the android device through adb.
I have set the path where adb is stored in ~/.bash_profile, ~/.profile, ~/.MACOSX/environment.plist. I also tried
launchctl setenv ANDROID_HOME /Users/sbc/Documents/platform-tools
It works after I set the path and run it on my IDE. but when I package the application as .app and run it gives exception.
And upon every restart, I have to set the path then run it on IDE and then run my packaged application otherwise it gives exception.
What am I doing wrong? I am fairly new to Mac OS
This is the exception I get
Exception in getting files from adb: Cannot run program "null/adb": error=2, No such file or directory
I also print the environments to my log file using
System.getenv();
It displays
{PATH=/usr/bin:/bin:/usr/sbin:/sbin, SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.xSbUa96s8s/Listeners, XPC_FLAGS=0x0, SHELL=/bin/bash, __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0, Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.1eYUtPE7oH/Render, LOGNAME=sbc, USER=sbc, XPC_SERVICE_NAME=SOME-GUID-USED-FOR-UPDATE-DETECTION.3084, HOME=/Users/sbc, TMPDIR=/var/folders/23/vtg9pg8n0kv48bqzt9550f5w0000gn/T/}
I found the solution for my problem.
I did the following steps,
In Intellij IDE under Run menu, there is a option EDIT Configurations, which opens up a window in which there is a field "Environment Variables" under "Configuration" tab. There I typed "="(without quotes). Then click OK.
Now build the application and run the application, if it does not detect the environment variables, then try to set them again. Now after setting the environment variables, restart the application.