ArrayOutOfBounds exception during Android app build process

Hi,

I’ve just started playing with Silver and am trying to create a small app using Sugar. I currently only have a basic Android project containing a layout with 2 elements and a Shared Project that has a single class with some setters but no real logic yet.

When I try to build the project I see the error below and I’m not sure what’s causing it. I’ve tried removing the top level ‘import Sugar’ line but that’s had no effect.

Could anyone help me understand what’s going on please?

Cheers,

sevan

                              ignored resource DEBUG_INFO/sugar.cooper.LocaleUtils.di
                              processing sugar/TimeSpan.class...
                              /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Cooper.Android.targets: error : UNEXPECTED TOP-LEVEL EXCEPTION:

com.android.dex.util.ExceptionWithContext: 2
at com.android.dex.util.ExceptionWithContext.withContext(ExceptionWithContext.java:45)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:371)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
at com.android.dx.command.dexer.Main.processClass(Main.java:682)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
at com.android.dx.cf.code.OneLocalsArray.set(OneLocalsArray.java:121)
at com.android.dx.cf.code.Frame.initializeWithParameters(Frame.java:164)
at com.android.dx.cf.code.Ropper.setFirstFrame(Ropper.java:760)
at com.android.dx.cf.code.Ropper.doit(Ropper.java:726)
at com.android.dx.cf.code.Ropper.convert(Ropper.java:346)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:282)
… 15 more
…while processing Add (J)J
…while processing sugar/TimeSpan.class
1 error; aborting

                              : error AP1: Error while running Android tool: dx.bat
                                                      Task "AndroidPack" execution -- FAILED

I am having the same exact error for Android project. Does anybody have any idea what may be causing that?

Can one of you send us the project that shows this behavior? Either here or privately (support@ or via private messages on the forum).

In my scenario I am following the directions from this url: http://docs.elementscompiler.com/Tutorials/Sugar/CrossPlatformApps/

I create a solution, add my ios, android and shared code projects. I then add the sugar libraries to both android and ios. Once I click to build the project I get the error described above.

MyApp.zip (693.7 KB)

Attaching my projects

DLapp.zip (448.0 KB)

Thanks, logged as bugs://73895

Thanks for responding so quickly, can we track the resolution of this bug somehow?

Do you know how long the bug has affected Sugar/Fire? It looks like you have a lot of iOS developers but not so many Android devs to find issues like this.

Cheers,

Sevan

You can track this bug by well tracking this thread. Once it’s fixed the “bugs bot” will respond again with “it’s fixed”, basically set the dropdown at the bottom to tracking:

not sure how long this bug has been around, not long though.

Ah, thanks.

Sevan

So this bug is already fixed in the beta. You can join the beta by joining here: https://secure.remobjects.com/portal/silver.aspx

you will have to recompile Sugar/Android to fix this error though.

bugs://73895 got closed with status fixed.

Thanks, I’ve downloaded the alpha 8.3.92.1901.

By recompiling Sugar/Android do you mean just clean then rebuild my project or do I actually need to rebuild the Sugar.fx? I’ve tried cleaning then building my project and I see the same error, so I assume that I need to recompile Sugar.fx? If so, are there instructions on how I do that?

Cheers,

Sevan

Never mind, I found the instructions in this thread: Error when referencing Sugar

Are these changes on the master or beta branch? Just want to make sure I’m pulling the correct branch to recompile sugar.

@aoathout: Develop or beta branch; but the important part is actually recompiling it with the new compiler.