EBuild unable to process Retrofit library

I’m trying to add Retrofit to an Android app via Gradle Reference, but EBuild cannot process the library. I get error

dex: trouble processing "javax/xml/parsers/DocumentBuilder.class":

I’m running this on 10.0.0.2447. Here’s my ebuild --debug output and test project.

C:\Users\mattr\Code\Elements\retrofit.tests>ebuild retrofit.tests.sln --debug
RemObjects EBuild. An open source build engine for Elements and beyond.
Copyright RemObjects Software 2016-2019. All Rights Reserved. Created by marc hoffman.
Version 10.0.0.2447 (develop) built on bajor, 20191018-150826. Commit 09b1506.
   -> Task RemObjects.EBuild.BuildSolution started.
      -> Project retrofit.tests started.
         -> Task RemObjects.EBuild.Elements.ElementsBuildProject started for retrofit.tests.
            -> Task RemObjects.EBuild.Elements.ElementsApplyLegacySettings started for retrofit.tests, Cooper-Android.
               Mapping AssemblyName=retrofit.tests to BinaryName in Target Cooper-Android
            <- Task RemObjects.EBuild.Elements.ElementsApplyLegacySettings finished for retrofit.tests, Cooper-Android, took 0.0161s (0.0170s).
            -> Task RemObjects.EBuild.Elements.ElementsSanityCheck started for retrofit.tests, Cooper-Android.
            <- Task RemObjects.EBuild.Elements.ElementsSanityCheck finished for retrofit.tests, Cooper-Android, took 0.0010s (0.0010s).
            -> Task RemObjects.EBuild.Elements.ElementsPreparePlatforms started for retrofit.tests.
               Preparing target 'Cooper-Android' (platform 'Cooper').
D:             Target-specific Settings, before prepare
D:               - <BinaryName = retrofit.tests [Target: Cooper-Android]>
D:               - <Mode = Cooper [Target: Cooper-Android]>
D:               - <SubMode = Android [Target: Cooper-Android]>
               -> Task RemObjects.EBuild.Elements.ElementsPreflightCooper started for retrofit.tests.
                  JDK found in 'C:\Program Files\Java\jdk1.8.0_171'.
                  Libraries found in 'C:\Program Files\Java\jdk1.8.0_171\jre\lib'.
                  Java executable found at 'C:\Program Files\Java\jdk1.8.0_171\jre\bin\java.exe'.
               <- Task RemObjects.EBuild.Elements.ElementsPreflightCooper finished for retrofit.tests, took 0.0329s (0.0329s).
               -> Task RemObjects.EBuild.Elements.ElementsPrepareCooperPlatform started for retrofit.tests, Cooper-Android.
               <- Task RemObjects.EBuild.Elements.ElementsPrepareCooperPlatform finished for retrofit.tests, Cooper-Android, took 0.0130s (0.0479s).
               -> Task RemObjects.EBuild.Elements.ElementsPreflightAndroid started for retrofit.tests.
                  Android SDK found in 'C:\Users\mattr\AppData\Local\Android\Sdk'.
                  Android Build Tools found in 'C:\Users\mattr\AppData\Local\Android\Sdk\build-tools\28.0.3'.
                  Android ApkBuilder found in 'C:\Users\mattr\AppData\Local\Android\Sdk\tools\lib\sdklib-26.0.0-dev.jar;C:\Users\mattr\AppData\Local\Android\Sdk\tools\lib\sdk-common-26.0.0-dev.jar;C:\Users\mattr\AppData\Local\Android\Sdk\tools\lib\common-26.0.0-dev.jar'.
               <- Task RemObjects.EBuild.Elements.ElementsPreflightAndroid finished for retrofit.tests, took 0.0030s (0.0040s).
               -> Task RemObjects.EBuild.Elements.ElementsPrepareCooperAndroidPlatform started for retrofit.tests, Cooper-Android.
                  No exact platform version was specified for target 'Cooper-Android', using android-28.
               <- Task RemObjects.EBuild.Elements.ElementsPrepareCooperAndroidPlatform finished for retrofit.tests, Cooper-Android, took 0.0030s (0.0080s).
D:             Target-specific Settings, after prepare
D:               - <AarCacheFolder = C:\Users\mattr\AppData\Local\RemObjects Software\EBuild\Obj\retrofit.tests-FE9F1F472ADCD3FDFAB25F137715D48F8F96BF52\Release\Cooper-Android\aar [Target: Cooper-Android]>
D:               - <AndroidPack = True [Target: Cooper-Android]>
D:               - <AndroidPlatformFolder = C:\Users\mattr\AppData\Local\Android\Sdk\platforms\android-28 [Target: Cooper-Android]>
D:               - <AndroidPlatformName = android-28 [Target: Cooper-Android]>
D:               - <BinaryName = retrofit.tests [Target: Cooper-Android]>
D:               - <Mode = Cooper [Target: Cooper-Android]>
D:               - <SubMode = Android [Target: Cooper-Android]>
            <- Task RemObjects.EBuild.Elements.ElementsPreparePlatforms finished for retrofit.tests, took 0.0618s (0.0648s).
            -> Task RemObjects.EBuild.Elements.ElementsResolveSourceFiles started for retrofit.tests, Cooper-Android.
            <- Task RemObjects.EBuild.Elements.ElementsResolveSourceFiles finished for retrofit.tests, Cooper-Android, took 0.0100s (0.0110s).
            -- Task RemObjects.EBuild.Elements.ElementsResolveHeaderImportFiles skipped for retrofit.tests, Cooper-Android, condition not met.
            -> Task RemObjects.EBuild.Elements.ElementsPreCompile started for retrofit.tests, Cooper-Android.
               -- Task RemObjects.EBuild.Elements.ElementsPreCompileEchoes skipped for retrofit.tests, Cooper-Android, condition not met.
               -- Task RemObjects.EBuild.Elements.ElementsPreCompileToffee skipped for retrofit.tests, Cooper-Android, condition not met.
               -> Task RemObjects.EBuild.Elements.ElementsPreCompileCooper started for retrofit.tests, Cooper-Android.
               <- Task RemObjects.EBuild.Elements.ElementsPreCompileCooper finished for retrofit.tests, Cooper-Android, took 0.0000s (0.0000s).
               -- Task RemObjects.EBuild.Elements.ElementsPreCompileIsland skipped for retrofit.tests, Cooper-Android, condition not met.
            <- Task RemObjects.EBuild.Elements.ElementsPreCompile finished for retrofit.tests, Cooper-Android, took 0.0000s (0.1027s).
            -- Task RemObjects.EBuild.Elements.ElementsApplyLegacySettings skipped for retrofit.tests, Cooper-Android, already ran.
            -- Task RemObjects.EBuild.Elements.ElementsPreparePlatforms skipped for retrofit.tests, already ran.
            -> Task RemObjects.EBuild.Elements.ElementsCheckForTargetlessReferences started for retrofit.tests.
            <- Task RemObjects.EBuild.Elements.ElementsCheckForTargetlessReferences finished for retrofit.tests, took 0.0020s (0.0020s).
            -> Task RemObjects.EBuild.Elements.ElementsResolveReferences started for retrofit.tests.
               -> Target Cooper-Android started.
                  -> Task RemObjects.EBuild.Elements.ElementsResolveCooperReferencesForTarget started for retrofit.tests, Cooper-Android.
                     Reference 'android' was resolved to 'C:\Users\mattr\AppData\Local\Android\Sdk\platforms\android-28\android.jar' for target 'Cooper-Android'.
                     Reference 'cooper' was resolved to 'C:\Program Files (x86)\RemObjects Software\Elements\References\Cooper\cooper.jar' via XML for target 'Cooper-Android'.
                  <- Task RemObjects.EBuild.Elements.ElementsResolveCooperReferencesForTarget finished for retrofit.tests, Cooper-Android, took 0.0519s (0.0519s).
                  -> Task RemObjects.EBuild.Elements.ElementsProcessGradleReferences started for retrofit.tests, Cooper-Android.
D:                   Package com.squareup.retrofit2:retrofit:2.6.2 found in local cache.
                     Adding dependency 'com.squareup.okhttp3:okhttp:*' from 'com.squareup.retrofit2:retrofit:2.6.2'.
D:                   Package com.squareup.okhttp3:okhttp:4.2.2 found in local cache.
                     Adding dependency 'com.squareup.okio:okio:2.2.2' from 'com.squareup.okhttp3:okhttp:4.2.2'.
D:                   Package com.squareup.okio:okio:2.4.1 found in local cache.
                     Adding dependency 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50' from 'com.squareup.okio:okio:2.4.1'.
D:                   Package org.jetbrains.kotlin:kotlin-stdlib:1.3.50 found in local cache.
                     Adding dependency 'org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50' from 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50'.
D:                   Package org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50 found in local cache.
                     Adding dependency 'org.jetbrains:annotations:13.0' from 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50'.
D:                   Package org.jetbrains:annotations:17.0.0 found in local cache.
D:                   Dependency 'org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50' is already referenced.
D:                   Dependency 'org.jetbrains.kotlin:kotlin-stdlib:1.3.50' is already referenced.
                     Adding dependency 'com.google.android:android:*' from 'com.squareup.retrofit2:retrofit:2.6.2'.
D:                   Package com.google.android:android:4.1.1.4 found in local cache.
                     Adding dependency 'commons-logging:commons-logging:1.1.1' from 'com.google.android:android:4.1.1.4'.
D:                   Package commons-logging:commons-logging:1.2 found in local cache.
                     Adding dependency 'log4j:log4j:1.2.17' from 'commons-logging:commons-logging:1.2'.
D:                   Package log4j:log4j:1.2.17 found in local cache.
                     Adding dependency 'javax.mail:mail:1.4.3' from 'log4j:log4j:1.2.17'.
D:                   Package javax.mail:mail:1.4.7 found in local cache.
                     Adding dependency 'org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.0' from 'log4j:log4j:1.2.17'.
E:                   The process cannot access the file 'C:\Users\mattr\AppData\Local\RemObjects Software\EBuild\Packages\Gradle\org/apache/geronimo/specs/geronimo-jms_1/1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.pom' because it is being used by another process.
D:                   |    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath).
D:                   |    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost).
D:                   |    at RemObjects.Elements.RTL.File.CopyTo__$mapped______(String self, String Destination, String NewName, Boolean aCloneIfPossible).
D:                   |    at RemObjects.Elements.RTL.File.CopyTo__$mapped____(String self, String NewPathAndName, Boolean aCloneIfPossible).
D:                   |    at RemObjects.Elements.RTL.File.CopyTo(String aFileName, String NewPathAndName, Boolean aCloneIfPossible).
D:                   |    at RemObjects.Elements.Basics.ConcreteMavenPackage..ctor(Url aUrl, String aName, String aVersion).
D:                   |    at RemObjects.Elements.Basics.MavenRepository.$meta_GetCachedCopyOfConcretePackageWithName(MetaClass $meta, String aName, String aVersion).
D:                   |    at RemObjects.Elements.Basics.MavenRepository.$meta_GetBestMatchingCachedCopyOfConcretePackageWithName(MetaClass $meta, String aName, String aVersion).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.FindConcretePackageWithName(String aName, String aVersion).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference).
D:                   |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.Execute().
D:                   |    at RemObjects.EBuild.EBuildContext.RunTask________forTarget(MetaClass aTask, EBuildValues aSettings, EBuildObjects aObjects, EBuildTarget aTarget).
                  <- Task RemObjects.EBuild.Elements.ElementsProcessGradleReferences failed with exception The process cannot access the file 'C:\Users\mattr\AppData\Local\RemObjects Software\EBuild\Packages\Gradle\org/apache/geronimo/specs/geronimo-jms_1/1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.pom' because it is being used by another process. for retrofit.tests, Cooper-Android, took 0.0000s (0.1290s).
D:                |    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
D:                |    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
D:                |    at RemObjects.Elements.RTL.File.CopyTo__$mapped______(String self, String Destination, String NewName, Boolean aCloneIfPossible)
D:                |    at RemObjects.Elements.RTL.File.CopyTo__$mapped____(String self, String NewPathAndName, Boolean aCloneIfPossible)
D:                |    at RemObjects.Elements.RTL.File.CopyTo(String aFileName, String NewPathAndName, Boolean aCloneIfPossible)
D:                |    at RemObjects.Elements.Basics.ConcreteMavenPackage..ctor(Url aUrl, String aName, String aVersion)
D:                |    at RemObjects.Elements.Basics.MavenRepository.$meta_GetCachedCopyOfConcretePackageWithName(MetaClass $meta, String aName, String aVersion)
D:                |    at RemObjects.Elements.Basics.MavenRepository.$meta_GetBestMatchingCachedCopyOfConcretePackageWithName(MetaClass $meta, String aName, String aVersion)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.FindConcretePackageWithName(String aName, String aVersion)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.ProcessGradleReference(EBuildObject aReference)
D:                |    at RemObjects.EBuild.Elements.ElementsProcessGradleReferences.Execute()
D:                |    at RemObjects.EBuild.EBuildContext.RunTask________forTarget(MetaClass aTask, EBuildValues aSettings, EBuildObjects aObjects, EBuildTarget aTarget)
               <- Target Cooper-Android failed.
            <- Task RemObjects.EBuild.Elements.ElementsResolveReferences failed for retrofit.tests, took 0.2168s (0.2198s).
         <- Task RemObjects.EBuild.Elements.ElementsBuildProject failed for retrofit.tests, took 0.0000s (0.3286s).
      <- Project retrofit.tests failed, took 0.3286s.
      Project 'retrofit.tests' failed to build.
      Solution 'retrofit.tests' failed to build all projects.
   <- Task RemObjects.EBuild.BuildSolution failed for retrofit.tests, took 0.3426s (0.3455s).

retrofit.tests.zip (33.5 KB)

While the log file you actually posted shows a totally different error, I can reproduced this issue, however, there’s a rather detailed explanation form DEX (which is not our tool, but part of the core Android tool chain:

E:                   dex: trouble processing "javax/xml/parsers/DocumentBuilder.class":
                     dex> Ill-advised or mistaken usage of a core class (java.* or javax.*)
                     dex> when not building a core library.
                     dex> This is often due to inadvertently including a core library file
                     dex> in your application's project, when using an IDE (such as
                     dex> Eclipse). If you are sure you're not intentionally defining a
                     dex> core class, then this is the most likely explanation of what's
                     dex> going on.
                     dex> However, you might actually be trying to define a class in a core
                     dex> namespace, the source of which you may have taken, for example,
                     dex> from a non-Android virtual machine project. This will most
                     dex> assuredly not work. At a minimum, it jeopardizes the
                     dex> compatibility of your app with future versions of the platform.
                     dex> It is also often of questionable legality.
                     dex> If you really intend to build a core library -- which is only
                     dex> appropriate as part of creating a full virtual machine
                     dex> distribution, as opposed to compiling an application -- then use
                     dex> the "--core-library" option to suppress this error message.
                     dex> If you go ahead and use "--core-library" but are in fact
                     dex> building an application, then be forewarned that your application
                     dex> will still fail to build or run, at some point. Please be
                     dex> prepared for angry customers who find, for example, that your
                     dex> application ceases to function once they upgrade their operating
                     dex> system. You will be to blame for this problem.
                     dex> If you are legitimately using some code that happens to be in a
                     dex> core package, then the easiest safe alternative you have is to
                     dex> repackage that code. That is, move the classes in question into
                     dex> your own package namespace. This means that they will never be in
                     dex> conflict with core system classes. JarJar is a tool that may help
                     dex> you in this endeavor. If you find that you cannot do this, then
                     dex> that is an indication that the path you are on will ultimately
                     dex> lead to pain, suffering, grief, and lamentation.

Ah, strange. I’ll have to look into why I don’t get this issue in my Android Studio project builds then.

I’ll also have a deeper look in a bit, might be that there’s sometime we should exclude from the gradle package (or one of the depends cues) that we don’t, properly…

I’m betting this is the problem here:

I’ll probably have to hard-blacklist that, as you’re not supposed to copy-local the core android ref.

1 Like

Yep, that fixed it.

Workaround until Friday: add <ExcludeGradleDependency Include="com.google.android:android" /> as item to your project.

1 Like

Perfect, that seems to have worked! I did notice as well that when I added the exclude tag, Water shows the excluded reference in the References list with the yellow icon that normally indicates that it was unable to resolve this reference. I assume that was not the intended behavior.

Thanks for your help with this!

water_exclude

Yeah, I should fix that. Fire/Water just thinks it’s a reference :wink:

fixed, but oddly I didn’t reproduce this even before my fix, Does it show an error message in the main view when you select the item?

Hmm, no error message. If I right click the item, I do get the option “Drop exclude from project” instead of the normal Reference context menu. I assume this is the correct spot to add it?

<ItemGroup>
    <Reference Include="android" />
    <Reference Include="cooper">
      <Private>True</Private>
    </Reference>
    <GradleReference Include="com.squareup.retrofit2:retrofit:2.6.2">
      <Private>True</Private>
    </GradleReference>
	<ExcludeGradleDependency Include="com.google.android:android" />
  </ItemGroup>

Yeah, it is.

Odd. in any case, I fixed it so it’ll never show an error overlay for excludes, for vNext…