BUILD FAILED on Android Studio 1.5.1 / API 23.0.3 (Marshmallow)

java
android

(Loreto Parisi) #1

The build fails on Android Studio 1.5.1 / API 23.0.2
I have added the following libraries:

  • sugar,jar
  • swift.jar
  • com.remobjects.elements.rtl.jar

And I compile against: jdk1.8.0_45.jdk

And a very simple example library (just a class with a method).

It perfectly works on Xcode 7.1.1 using the following libraries:

  • libSwift.a
  • libSugar.a
  • libNougat.a

On AndroidStudio java compiler complains that (adding --stacktrace --debug to build options in the app settings)

processing sugar/xml/XmlDocumentType.class…
processing sugar/xml/XmlElement.class…
processing sugar/xml/XmlNode.class…
processing sugar/xml/XmlNodeType.class…
processing sugar/xml/XmlProcessingInstruction.class…
processing sugar/xml/XmlText.class…

**18:13:17.918 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"simple","text":"Uncaught translation error: com.android.dex.util.ExceptionWithContext: 2","sources":[{}]}**
**AGPBI: {"kind":"simple","text":"Uncaught translation error: com.android.dex.util.ExceptionWithContext: 2","sources":[{}]}**
**AGPBI: {"kind":"simple","text":"2 errors; aborting","sources":[{}]}**


18:13:17.919 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:preDexDebug'
18:13:17.919 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:preDexDebug FAILED
18:13:17.920 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:preDexDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 11.905 secs.
18:13:17.920 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 2,5,main]] finished, busy: 12.422 secs, idle: 0.033 secs



18:13:17.921 [ERROR] [org.gradle.BuildExceptionReporter] 
18:13:17.922 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
18:13:17.922 [ERROR] [org.gradle.BuildExceptionReporter] 
18:13:17.922 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
18:13:17.922 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:preDexDebug'.
18:13:17.922 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
18:13:17.923 [ERROR] [org.gradle.BuildExceptionReporter] 
18:13:17.923 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
18:13:17.923 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:preDexDebug'.


(...more)


18:13:17.923 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
18:13:17.924 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
18:13:17.925 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
18:13:17.926 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:49)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.927 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.util.Swapper.swap(Swapper.java:38)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
18:13:17.928 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.929 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:116)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.ide.common.internal.WaitableExecutor$waitForTasksWithQuickFail$0.call(Unknown Source)
18:13:17.930 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.build.gradle.tasks.PreDex.taskAction(PreDex.groovy:114)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] 	... 57 more
18:13:17.931 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
18:13:17.932 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
18:13:17.932 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1387)
18:13:17.932 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:122)
18:13:17.936 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1330)
18:13:17.936 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.builder.core.AndroidBuilder$preDexLibrary$1.call(Unknown Source)
18:13:17.936 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy:158)
18:13:17.936 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy)
18:13:17.936 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
18:13:17.937 [ERROR] [org.gradle.BuildExceptionReporter] 	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
18:13:17.937 [ERROR] [org.gradle.BuildExceptionReporter] 	at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
18:13:17.937 [ERROR] [org.gradle.BuildExceptionReporter] 	... 6 more
18:13:17.937 [ERROR] [org.gradle.BuildExceptionReporter]

(Carlo Kok) #2

Hi 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 (see Error when referencing Sugar for instructions)


(Loreto Parisi) #3

@ck great thank you! Going to try the beta. Which was the technical issue with the translation btw?


(Carlo Kok) #4

In 1 of the functions of Sugar “maxlocals” was set wrong. It caused Android to fail with that rather obscure error (but java has no issue with it)


(Loreto Parisi) #5

@ck Question I’m running on Mac, no ways to compile Sugar with Xamarin?


(Carlo Kok) #6

No but you have the Fire IDE right? Sugar builds with Fire too.


(Loreto Parisi) #7

Ah so! thank you I will try that way!


(Loreto Parisi) #8

So I have tried using Fire (the latest beta just downloaded) and then opened Sugar.sln. I have compiled the

Sugar.Cooper target and I get errors:

mono /Applications/Fire.app/Contents/Resources/Mono/lib/mono/4.5/xbuild.exe /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln /nologo /target:Build /verbosity:normal /property:Configuration=Debug "/property:ElementsXbuildNougatSDKFolder=/Applications/Fire.app/Contents/Resources/Nougat SDKs" "/property:ElementsXbuildReferencePathsXMLFolder=/Applications/Fire.app/Contents/Resources/Reference Paths with Data Abstract Trial" /toolsversion:4.0

Build started 14/12/2015 18:58:58.
__________________________________________________
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.Data/Sugar.Data.Echoes.WP8.oxygene:  warning : Could not find project file /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/WindowsPhone/v8.0/RemObjects.Oxygene.Echoes.WindowsPhone.targets, to import. Ignoring.
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene:  warning : Could not find project file /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/WindowsPhone/v8.0/RemObjects.Oxygene.Echoes.WindowsPhone.targets, to import. Ignoring.
Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln" (Build target(s)):
        Target ValidateSolutionConfiguration:
                Building solution configuration "Debug|AnyCPU".
        Target Build:
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.OSX.oxygene" (default target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        Target CopyFXToOutputDirectory:
                                Copying file from '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/obj/Debug/OS X/libSugar.fx' to '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/bin/OS X/libSugar.fx'
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.OSX.oxygene".
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.iOS.oxygene" (default target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        Target CopyFXToOutputDirectory:
                                Copying file from '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/obj/Debug/iOS/libSugar.fx' to '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/bin/iOS/libSugar.fx'
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.iOS.oxygene".
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.tvOS.oxygene" (default target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        Target CopyFXToOutputDirectory:
                                Copying file from '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/obj/Debug/tvOS/libSugar.fx' to '/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/bin/tvOS/libSugar.fx'
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.tvOS.oxygene".
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.watchOS.oxygene" (default target(s)):
                        Target GetTargetSDK:
:  CrossBox error GetTargetSDKType: No matching version of Unknown has been found that is supported by both your local .fx files (supported versions are: none) and the active version of Xcode (supported versions are: none).
                                Visit the following URL to read more about getting support for other SDK versions: http://docs.elementscompiler.com/Platforms/Cocoa/ImportingSDKs
                        Task "GetTargetSDKType" execution -- FAILED
                        Done building target "GetTargetSDK" in project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.watchOS.oxygene".-- FAILED
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.watchOS.oxygene".-- FAILED
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Cooper.oxygene" (default target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target CooperPreflight:
                                JDKRoot:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
                                JRERoot:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
                        Target ResolveAssemblyReferences:
                                Reference: com.remobjects.elements.rtl.jar
                                Reference: rt.jar
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                        Target CooperAfterCompile:
                        Skipping target "CooperAfterCompile" because its outputs are up-to-date.
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Cooper.oxygene".
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Cooper.Android.oxygene" (default target(s)):
                        Target CooperPreflight:
                                JDKRoot:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
                                JRERoot:/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target ResolveAssemblyReferences:
                                Reference: android.jar
                                Reference: com.remobjects.elements.rtl.jar
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Cooper.Android.oxygene".
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.oxygene" (default target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                        ('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
                          '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.oxygene".
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene: error : /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene: /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene could not import "$(MSBuildExtensionsPath)/RemObjects Software/Oxygene/$(TargetFrameworkIdentifier)/$(TargetFrameworkVersion)/RemObjects.Oxygene.Echoes.$(TargetFrameworkIdentifier).targets"
  at Microsoft.Build.BuildEngine.Import.ForEachExtensionPathTillFound (System.Xml.XmlElement xmlElement, Microsoft.Build.BuildEngine.Project project, Microsoft.Build.BuildEngine.ImportedProject importingProject, System.Func`3 func) <0x10a3a45b0 + 0x00adb> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.AddImport (System.Xml.XmlElement xmlElement, Microsoft.Build.BuildEngine.ImportedProject importingProject, Boolean evaluate_properties) <0x10a3a4260 + 0x002b4> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.ProcessElements (System.Xml.XmlElement rootElement, Microsoft.Build.BuildEngine.ImportedProject ip) <0x1095e7170 + 0x00441> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.ProcessXml () <0x1095e08e0 + 0x005e1> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader textReader) <0x1095eb940 + 0x004b0> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader textReader) <0x1095eb940 + 0x00593> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName, ProjectLoadSettings settings) <0x1095e8f00 + 0x0049d> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) <0x1095e8ec0 + 0x0001b> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFileInternal (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, System.String toolsVersion) <0x10a39f8b0 + 0x003f0> in <filename unknown>:0 
  at Microsoft.Build.BuildEngine.Engine.BuildProjectFile (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, System.String toolsVersion) <0x10a39e470 + 0x00088> in <filename unknown>:0 
                Project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WinRT.oxygene" (default target(s)):
                        Target _ValidateWinRT:
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Echoes.WinRT.targets: error : Building for WinRT is currently only supported on Windows
                        Task "Error" execution -- FAILED
                        Done building target "_ValidateWinRT" in project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WinRT.oxygene".-- FAILED
                Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WinRT.oxygene".-- FAILED
        Task "MSBuild" execution -- FAILED
        Done building target "Build" in project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln".-- FAILED
Done building project "/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln".-- FAILED

Build FAILED.

Warnings:

/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.Data/Sugar.Data.Echoes.WP8.oxygene:  warning : Could not find project file /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/WindowsPhone/v8.0/RemObjects.Oxygene.Echoes.WindowsPhone.targets, to import. Ignoring.
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene:  warning : Could not find project file /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/WindowsPhone/v8.0/RemObjects.Oxygene.Echoes.WindowsPhone.targets, to import. Ignoring.

Errors:

/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln (Build) ->
(Build target) ->
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Nougat.watchOS.oxygene (default targets) ->
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Nougat.targets (GetTargetSDK target) ->

        :  CrossBox error GetTargetSDKType: No matching version of Unknown has been found that is supported by both your local .fx files (supported versions are: none) and the active version of Xcode (supported versions are: none).

/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln (Build) ->
(Build target) ->

        /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene: error : /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene: /Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WP8.oxygene could not import "$(MSBuildExtensionsPath)/RemObjects Software/Oxygene/$(TargetFrameworkIdentifier)/$(TargetFrameworkVersion)/RemObjects.Oxygene.Echoes.$(TargetFrameworkIdentifier).targets"

/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar.sln (Build) ->
(Build target) ->
/Volumes/MacHDD2/Developmemt/Java/sugar/Sugar/Sugar.Echoes.WinRT.oxygene (default targets) ->
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Echoes.WinRT.targets (_ValidateWinRT target) ->

        /Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Echoes.WinRT.targets: error : Building for WinRT is currently only supported on Windows

         2 Warning(s)
         3 Error(s)

Time Elapsed 00:00:03.4653000

(Carlo Kok) #9

Looks like your xcode install is different than what we expect and the WinPhone one doesn’t build (that last one expected). However here’s a zip with the fixed sugar jar:

sugar.zip (136.9 KB)


(Loreto Parisi) #10

Ah ok, I have just updated to Xcode Version 7.2 (7C68). Are you going to support this in Sugar project then?


(Carlo Kok) #11

Yes. We’re working on a fix for 7.2


(Loreto Parisi) #12

Great thank you for the jar. Going to try as soon as my nexus 7 stops to upgrade!


(Loreto Parisi) #13

@ck thanks.

So I have added to build setting yours file

  • sugar.jar

and then added from Fire beta

  • swift.jar
  • come.remobjects.elements.rtl.jar

The simple swift library was simple as:

and then I just do

import samplelibrary.*;

and something like

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    MiaClasse2 sampleAPI = new MiaClasse2();
    String apiURL = "http://www.musixmatch.com";

    sampleAPI.httpCall(apiURL);

    int result = sampleAPI.add__b(5,12);

    Log.d("TEST", Integer.toString(result));

}

//…

The issue was:

Caused by: java.lang.ClassNotFoundException: Didn’t find class “java.awt.EventQueue” on path: DexPathList[[zip file “/data/app/musixmatch.com.sampleandroidapp-2/base.apk”],nativeLibraryDirectories=[/data/app/musixmatch.com.sampleandroidapp-2/lib/arm, /vendor/lib, /system/lib]]

Following the full stacktrace:

12-15 12:07:27.675 30350-30350/? I/art: Late-enabling -Xcheck:jni
12-15 12:07:27.743 30350-30350/musixmatch.com.sampleandroidapp W/System: ClassLoader referenced unknown path: /data/app/musixmatch.com.sampleandroidapp-2/lib/arm
12-15 12:07:27.842 30350-30350/musixmatch.com.sampleandroidapp I/System.out: http://www.musixmatch.com
12-15 12:07:27.846 30350-30350/musixmatch.com.sampleandroidapp D/AndroidRuntime: Shutting down VM
12-15 12:07:27.848 30350-30350/musixmatch.com.sampleandroidapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: musixmatch.com.sampleandroidapp, PID: 30350
java.lang.ExceptionInInitializerError
at com.remobjects.elements.system.FutureHelper.ExecuteAsync()
at sugar.Http.ExecuteRequest()
at samplelibrary.MiaClasse2.httpCall(/Users/admin/Documents/StaticLibrary/SharedProject/Library.swift:16)
at musixmatch.com.sampleandroidapp.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “java.awt.EventQueue” on path: DexPathList[[zip file “/data/app/musixmatch.com.sampleandroidapp-2/base.apk”],nativeLibraryDirectories=[/data/app/musixmatch.com.sampleandroidapp-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.remobjects.elements.system.AWTThreadSyncHelper.()
at com.remobjects.elements.system.Task.()
at com.remobjects.elements.system.FutureHelper.ExecuteAsync()
at sugar.Http.ExecuteRequest()
at samplelibrary.MiaClasse2.httpCall(/Users/admin/Documents/StaticLibrary/SharedProject/Library.swift:16)
at musixmatch.com.sampleandroidapp.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: java.awt.EventQueue
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
… 19 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
12-15 12:07:32.844 30350-30350/? I/Process: Sending signal. PID: 30350 SIG: 9


(Carlo Kok) #14

very curious. I use code like tihs:

    &Class.forName("android.app.Activity");
    ThreadSyncHelper := new AndroidThreadSyncHelper;

to detect android, else it reverts to AWT, but since you call this from an Activity that should work just fine.


(Loreto Parisi) #15

@ck From the stack trace it seems to me that this happens in the jar com.remobjects.elements.rtl.jar, or I am wrong?


(Carlo Kok) #16

You’re not wrong. That’s the future/task code. The http logic uses it for async requests, specifically this:

It looks like that needs a slightly newer version than the one included with Fire:
com.remobjects.elements.rtl.jar.zip (106.2 KB)

If that doesn’t work, can you send me the full test project?


(Loreto Parisi) #17

@ck Yes please. Drop me your email, I’m going to send you both the Fire project with the cross-library test and the sample android app (from AndroidStudio).

Thanks for the updated jar. This time I get it working partially. In fact I can see a logging withing the sdk, but the HTTP request started.


(Loreto Parisi) #18

@ck I have tried several ways to make http calls like

 public func httpCall(var url: String, completion: (response:String?) ->()  )	
{
	
	println(url);

	let jsonCallback: HttpContentResponseBlock<Sugar.Json.JsonDocument!>! = { response in 
		if response.Success {
			var obj = response.Content.RootObject
			println( "JSON RESPONSE " )
			println( obj)
		}
	}
	Http.ExecuteRequestAsJson( Url(url), jsonCallback)
	
	Http.ExecuteRequest(Url( url ), { response in
		println (response )
	})
	
	Http.ExecuteRequest(Url(url), { response in
		if response.Success {
			response.GetContentAsString(nil) { content in
				if content.Success {
					writeLn("Response was: "+content.Content);
					completion( content.Content )
				}
			}
		}
	});
	
	/*let plainCallback: HttpResponseBlock<String!>! = { response in
	
	}*/
	
	//Http.ExecuteRequest(Url( url ), plainCallback)
}

and for the Android Java counterpart, this time I have used a AsyncTask to embed the library call like

 private class BrowserTask extends AsyncTask<String, Void, String> {
    @Override
    protected String doInBackground(String... params) {

        MiaClasse2 sampleAPI = new MiaClasse2();
        String apiURL = "https://api.spotify.com/v1/search?q=tania%20bowra&type=artist";

        Log.d("TEST", "Now calling sdk");

        sampleAPI.httpCall__completion(apiURL, new Action1<String>() {
            @Override
            public void run(String s) {
                Log.d("TEST", s);
            }
        });

        int result = sampleAPI.add__b(5,12);

        Log.d("TEST", Integer.toString(result));

        return null;
    }

    @Override
    protected void onPostExecute(String result) {
    }

    @Override
    protected void onPreExecute() {
    }

    @Override
    protected void onProgressUpdate(Void... values) {
    }
} 

And it works for both the ExecuteRequestAsJson and ExecuteRequest.
Now I have two questions

  1. How to pass back the json object to the Android couterpart to have it like a parsable json object i.e. which is the Sugar.Json.JsonDocument mapping in Android and iOS of course)?

  2. How to write this completion handler with no errors:

    // this code generates a "No matching overload" error.
    

    let plainCallback: HttpResponseBlock<String!>! = { response in

    }
    Http.ExecuteRequest(Url( url ), plainCallback)


(Carlo Kok) #19

Json doesn’t map on Java (since there’s no json class included with Java); The classes are plainly usable from java, in the sugar.json namespace (JsonObject and friends).[quote=“Loreto_Parisi, post:18, topic:7719”]
How to write this completion handler with no errors:
// this code generates a “No matching overload” error. let plainCallback: HttpResponseBlock! = { response in
} Http.ExecuteRequest(Url( url ), plainCallback)
[/quote]

I think it wants a HttpResponseBlock, not HttpResponseBlock! does it say something more as a hint?