"Unknown namespace" errors for top level Java & Android packages

I am trying to fix an issue where a project compiles for another member of our team but not for me. I am able to build and compile the RemObjects sample projects without errors, but I hit a number of errors with our project which our other team member does not. The only changes I made are to use package references for the Android support libraries (v4, appcompat, design) in place of his direct references. We are using the same version of Elements and the Android build tools but have different versions of jre/jdk.

Here is the output of ebuild .\project.sln --debug on my machine.

                     Entering phase "Resolving Namespaces" (00:00:00.0009982)
E:                   Unknown namespace "java.util" in uses list \path\to\project\UX_New\CanvasLightView.pas (5)]
E:                   Unknown namespace "android.app" in uses list \path\to\project\UX_New\CanvasLightView.pas (6)]
E:                   Unknown namespace "android.content" in uses list \path\to\project\UX_New\CanvasLightView.pas (7)]
E:                   Unknown namespace "android.graphics" in uses list \path\to\project\UX_New\CanvasLightView.pas (8)]
E:                   Unknown namespace "android.os" in uses list \path\to\project\UX_New\CanvasLightView.pas (9)]

E:                   .... about 250 more lines of these ....

E:                   Unknown namespace "java.util" in uses list \path\to\project\TheCommonCode\p205Version.pas (14)]
E:                   Unknown namespace "java.util" in uses list \path\to\project\TheCommonCode\p200ProtoVersion.pas (13)]
                     Entering phase "Resolving Types" (00:00:00.0765681)
E:                   A Java base library reference is missing and no default "rt.jar" could be found
                     <- Target Cooper failed compiling.
D:                   CompilerOutput for Cooper
D:                   LinkLibraries for Cooper
D:                   LinkFrameworks for Cooper
                  <- Task RemObjects.EBuild.Elements.ElementsCoreCompile failed, took 2.8568s (13.2409s).
               <- Task RemObjects.EBuild.Elements.ElementsLink failed, took 0.0000s (13.2409s).
            <- Task RemObjects.EBuild.Elements.ElementsDetermineFinalOutput failed, took 0.0000s (13.2419s).
         <- Task RemObjects.EBuild.Elements.ElementsCopyFinalOutput failed, took 0.0000s (13.2419s).
      <- Task RemObjects.EBuild.Elements.ElementsBuildProject failed, took 0.0000s (13.2419s).
      <- Project com.accordancebible.Accordance failed, took 13.2429s.
   <- Task RemObjects.EBuild.BuildSolution failed, took 15.1360s (15.1370s).

The output of ebuild --debug on his machine shows ebuild moving right through this step without errors.

Entering phase "Resolving Namespaces" (00:00:00.0009844)
Entering phase "Resolving Types" (00:00:00.0268288)

Any idea why ebuild is not recognizing top level Java and Android namespaces?

Can you give a more complete output of this project compile? It’s fairly likely it can’t find Android.jar somehow (might just be solved by explicitly setting the android path in the settings in Water/Fire/VS)

Sure thing. Here is the full output.

matt-ebuild-debug-out.txt (1.3 MB)

Here is the references section of our project file when using direct references. All of the paths are correct.

<ItemGroup>
    <Reference Include="android-support-design.jar">
      <HintPath>C:\Program Files (x86)\Android\android-sdk\extras\android\support\design\libs\android-support-design.jar</HintPath>
      <Private>true</Private>
    </Reference>
    <Reference Include="android-support-v4.jar">
      <HintPath>C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat\libs\android-support-v4.jar</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="android-support-v7-appcompat.jar">
      <HintPath>C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat\libs\android-support-v7-appcompat.jar</HintPath>
      <Private>true</Private>
    </Reference>
    <Reference Include="android.jar" />
    <Reference Include="cooper.jar">
      <HintPath>C:\Program Files (x86)\RemObjects Software\Elements\Cooper\Reference Archives\cooper.jar</HintPath>
      <Private>True</Private>
    </Reference>
  </ItemGroup>

And here is the ebuild --debug output when using direct references. Notice the errors at the bottom of the file now refer to AppCompat resources instead of Java or Android top level resources. For some reason, these are the build errors that display in Visual Studio regardless of whether I’m using direct or package references.

matt-ebuild-directrefs-debug-out.txt (1.3 MB)

the root problem is this:

                     Entering phase "Resolving Types" (00:00:00.0765681)
E:                   A Java base library reference is missing and no default "rt.jar" could be found
                     <- Target Cooper failed compiling.

can you post the full build log, so I can diagnose this better? it should fail way earlier, if t really cannot find the base Java SDK…

Full build log is posted above - once when using direct references and once when using package references as indicated in the comments.

Yeah, sorry abut that, missed that. It seems that your project ha son reference to “android.jar” itself. Can you confirm that, and add it (back)?

(I can confirm I get the same error when I remove the android ref from a new project; I’ll adjust so that this will fail more cleanly before even reading the compiler (or, better, add it implicitly)

Are you saying to add an explicit HintPath to the reference to android.jar in the project settings? If so, here is the output. The errors here are the same as those given in the ebuild --debug when I use direct references and also the same as the errors in Visual Studio when using direct or package references.

matt-ebuild-directrefs-androidjar-debug-out.txt (1.3 MB)

I’m saying that from what I can tell from the log, your project does not seem to have an android.jar reference.

That said, I note that in your second (full) log file, the reference is there (but also, the project now fails on different, unrelated errors). In the first log you posted, there’s no “android” reference being passed to the compiler (but the actual reference resolving isn’t visible in that log, because it was cached).

I posted the references section of my project file above. The android.jar reference currently is
<Reference Include="android.jar" />. Should this have an explicit HintPath to the android.jar or does ebuild pull it automatically from the Android sdk? I normally build from VS and have not had any android related errors but only appcompat related errors.

Yes, and that looks fine (you don’t need/should not add a hint path). But also note that the project, as of the second log you posted, no longer fails on this, but on errors in the XML files. Whatever caused the android reference to not working before, who knows, but for the last built you posted, it did work fine.

android.jar issue resolved. I’ll start a new thread for the appcompat issue.

1 Like