ARGS error when packaging project

Getting this error out of the blue when packaging APK for shipping.

ATHelper: Packaging (Android (ETC1)): ERROR: cmd.exe failed with args /c “C:/NVPACK/apache-ant-1.8.2/bin/ant.bat” release -Djava.source=1.7 -Djava.target=1.7

The famous ARGS error. It’s like blue screen of death type of thing.
I install all the build tools and platforms for API 26 that I’m using to package my project. Other then that I have no clue why this error is suddenly coming up. I was just able to package something about 5 hours ago and now new project and 5 H ago project wont package anymore. Any one has any idea what’s happening. Thank’s!!!

Hello. try this:
Start cmd.exe manually (win + r, type cmd and run with admin privilegies), then go to project path, for ex:

  1. cd C:\Unity\Mypoject\Intermediate\Android\APK\gradle\
  2. rungradle.bat :app:assembleDebug

If you will get some kind of java location error or path environment,
In my case i got this:

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_191

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.>

you can set your java jdk location with cmd command

setx JAVA_HOME -m

in my case:

setx JAVA_HOME -m “C:\NVPACK\jdk1.8.0_77\bin”

Hope this helps, and also try to run ue4 with admin privilegies too

Ok thanks for your help. Your answer is a bit more to the root of the problem rather then those I been finding on the net that just loop. The same answers over and over. (Uncheck use Gradle instead of ant…) lol. Thank you!