(AP1) Error while running Android tool: dx.bat

After a while I decided to try out Oxygene again to develop for Android.
Unfortunately, what worked before does not anymore. I get the error
(AP1) Error while running Android tool: dx.bat

I assume this has to do with the Java configuration. I recently had to uninstall a previous Java version which had severe security issues. I am now using 1.8.0.45 but I also tried an older one. The error is always there.

I uninstalled Elements and VS, reinstalled it. Installed SDK and the latest Elements (beta - 8.1.82.1741).
I have several sdks, in build tools I have 19, 20, 21 and 22. Unfortunately the error message remains.

Is there a way to test the prerequisites for using elements?

Does anybody have a tip what else I can try out to make it work again? Thanks!

Regards,
Julian

Can you try running dx.bat manually, see if any errors show up?

Oxygene should detect Java and Android as prerequisites properly, so this this must be something else.

Also, could you post the full error log? Thanx!

Can you try running dx.bat manually, see if any errors show up?
Oxygene should detect Java and Android as prerequisites properly, so this this must be something else.

Thanks for the tip. I tried that in cmd and got:

C:\Eclipse\sdk\build-tools\21.1.2>dx.bat
Error occurred during initialization of VM
Could not reserve enough space for 1048576KB object heap

I reinstalled the 64bit JAVA and made sure JAVE_HOME points to
C:\Eclipse\jdk1.8.0_45_x64

and voilĂ  - dx.bat produces a list of arguments instead of the error above.

Unfortunately the error in VS remained and, after I closed it and opened it I get this error immediately. The splashscreen of VS was just showing up.


Microsoft Visual Studio

Exception has been thrown by the target of an invocation.

I had that error yesterday (but not always) also and will now reboot to try if that fixes it.

After rebooting the message “Exception has been thrown by the target of an invocation.” was gone - but I am back at “(AP1) Error while running Android tool: dx.bat” and 9 warnings. (I am trying the HelloWorld sample)

In my Systemcontrol I have a “Java” item, I cannot see it is 64bit or not. So I deinstalled all Java entries from my system except for Java 64 bit and Java Development Kit 64 bit to make sure it uses the correct.

After restarting VS I still get

Error 9 (AP1) Error while running Android tool: dx.bat C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets 96 5 org.me.helloworld

and this 8 warnings.

What warnings do you get?

In the meantime I got:

Microsoft Visual Studio: Exception has been thrown by the target of an invocation.

and later

Microsoft Visual Studio: The ‘MRU Package’ package did not load correctly.

Visual Studio 2010 did not run either.

I did reboot, selected the 5.2 .NET Framework in “Software” and did a repair run. I also selected the Visual Studio 2013 Integrated and did a repair run.

I checked my System / Search Path - it was too long. I cleaned it up and shortened it by using %VAR% to replace longer directories.

Now VS 2010 works alright at VS 2013 starts again.

I can open “Hello World” and compile. One warning is shown this time and one error

Warning 1 () C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-ldpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-mdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-hdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets 0 0 org.me.helloworld

Error 1 (AP1) Error while running Android tool: dx.bat C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets 96 5 org.me.helloworld

Both this messages show up in other projects, too.

Is it possible that some items were not written to PATH because it was too long? Does Elements require any settings, i.e. C:\Program Files (x86)\RemObjects Software\Everwood\Bin ?

This is a fresh install of “RemObjects+Elements+with+Visual+Studio+2013±+8.0.81.1667.exe” downloaded in February which used to work fine.

BTW - is it required that “C:\Program Files (x86)\RemObjects Software\Everwood\Bin” is in the search path?

Everwood should be in the path yes.

The Target Invokation Exception is very strange though. Can you attach and find out where it happens and what the inner exception is?

The Target Invokation Exception appeared to be a .NET problem which was probably introduced by an error in the installation. I do not get it right now after removing a duplicated “german” .NET 4.5 and repairing the other.

I have Everwood in the path now (I also used a variable to shorten the string. The length of the path is restricted, nevertheless many programs add very long items to it).

But nothing has changed with the dx.bat error.

The output window contains:

------ Build started: Project: org.me.helloworld, Configuration: Debug ------
JDKRoot:C:\Eclipse\jdk1.8.0_45_x64
JRERoot:C:\Program Files (x86)\Java\jre8
C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets(0,0): warning : C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-ldpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-mdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\res\drawable-hdpi\icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

org.me.helloworld -> C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\bin\Debug\org.me.helloworld.jar

C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets(96,5): error AP1: Error while running Android tool: dx.bat
Done building project “org.me.helloworld.oxygene” – FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Julian

ah. Tools/Options/Projects and Solutions/Build and Run

set both output levels to Detailed should do it.

Great, now I get (shortened):

Could not reserve enough space for 1048576KB object heap

Is it still using the 32bit version? How is it selected?

The problem appears to be

C:\Program Files (x86)\Java\jre8\bin\java.exe

------ Build started: Project: org.me.helloworld, Configuration: Debug ------
Initial properties:



ALLUSERSPROFILE = C:\ProgramData
ANDROID_NDK = C:\Eclipse\android-ndk-r9d
ANDROID_SDK = C:\Eclipse\sdk
AndroidArchiveName = org.me.helloworld
AndroidAssetsFolder = assets
AndroidDevice = xxx
AndroidDeviceName = Lenovo B8080-H
AndroidPackageFullName = bin\Debug\org.me.helloworld.apk
AndroidPackageName = org.me.helloworld
AndroidPackageUnalignedName = bin\Debug\org.me.helloworld_unaligned.apk
AndroidPlatformName = android-10
AndroidResourcesFolder = res
AndroidSign = true
ANT_HOME = C:\Eclipse\Ant
APPDATA = C:\Users\Julian\AppData\Roaming
APR_ICONV_PATH = C:\Eclipse\Subversion\iconv

.,


CleanFile = org.me.helloworld.oxygene.FileListAbsolute.txt
CodeAnalysisTargets = C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\CooperCodeAnalysis.targets
CommonProgramFiles = C:\Program Files (x86)\Common Files
CommonProgramW6432 = C:\Program Files\Common Files
CommonTargetsPath = C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets

	Run: "C:\Program Files (x86)\Java\jre8\bin\java.exe"  -Xmx1024M -jar "C:\Eclipse\sdk\build-tools\22.0.1\lib\dx.jar" --dex --verbose --output="C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\classes.dex" --positions=lines "C:\Users\Public\Documents\RemObjects Samples\Oxygene for Java\Android\HelloWorld\obj\Debug\org.me.helloworld.jar"
	  Error occurred during initialization of VM
	  Could not reserve enough space for 1048576KB object heap

C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Android.targets(96,5): error AP1: Error while running Android tool: dx.bat
Done building project “org.me.helloworld.oxygene” – FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Can you try

? Seems it’s a memory issue.

I renamed the old 32bit Java directory and get - unsurprisingly - this message:

Error 1 (CP2) Paths to the Java SDK (JDK) and/or the Java Runtime Environment (JRE) are configured, but one or more of the paths were not found on disk. Please make sure the paths are correct. If you need help reinstalling Java, visit http://docs.elementscompiler.com//VisualStudio/Setup/JDK/. C:\Program Files (x86)\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Cooper.Common.targets 59 5 org.me.helloworld

The site http://docs.elementscompiler.com//VisualStudio/Setup/JDK/ shows me an option dialog I do not have in my VS2013. How can I set the path to JDK?

I do not understand the memory issue - I have 8GB on Win7, 64bit.

Tools/Options/Projects and Solutions/RemObjects Elements/Java Paths

I did not see that the first time. I now select this paths under Options:

Java runtime
C:\Eclipse\jdk1.8.0_45_x64\jre

Java SDK
C:\Eclipse\jdk1.8.0_45_x64\

(This is where I installed jdk-8u45-windows-x64.exe to.)

I had to restart VS2013 and - yes - it works! Thanks for your help!

So if anybody has the problem:

  • check java version (64 bit)
  • check java path in VS Options dialog
  • make sure the .NET frame work is ok
1 Like