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

**URL:** https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934
**Category:** Oxygene
**Tags:** visual-studio
**Created:** [July 17, 2018, 1:02pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934 "2018-07-17T13:02:51Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 1:02pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/1 "2018-07-17T13:02:51Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [July 17, 2018, 1:14pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/2 "2018-07-17T13:14:54Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 1:16pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/3 "2018-07-17T13:16:54Z")

</div>

Sure thing. Here is the full output.

[matt-ebuild-debug-out.txt](https://talk.remobjects.com/uploads/default/original/2X/d/da68688db24843df12a314f6a54399cff572beea.txt) (1.3 MB)

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 1:54pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/4 "2018-07-17T13:54:06Z")

</div>

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>
```

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 2:01pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/5 "2018-07-17T14:01:58Z")

</div>

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](https://talk.remobjects.com/uploads/default/original/2X/9/9a83bd354c810715aa2d10e6a67a617bb6c153d5.txt) (1.3 MB)

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [July 17, 2018, 2:31pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/6 "2018-07-17T14:31:31Z")

</div>

the root problem is this:

```auto
                     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…

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 2:33pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/7 "2018-07-17T14:33:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [July 17, 2018, 2:33pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/8 "2018-07-17T14:33:47Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 2:38pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/9 "2018-07-17T14:38:12Z")

</div>

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](https://talk.remobjects.com/uploads/default/original/2X/a/afe41a5fb6902a7ff1711ea1b500bd099b4f7d29.txt) (1.3 MB)

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [July 17, 2018, 2:51pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/10 "2018-07-17T14:51:02Z")

</div>

> [@zmattr](#):
>
> Are you saying to add an explicit `HintPath` to the reference to `android.jar` in the project settings?

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

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [July 17, 2018, 2:54pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/11 "2018-07-17T14:54:37Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 2:56pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/12 "2018-07-17T14:56:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [July 17, 2018, 2:58pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/13 "2018-07-17T14:58:54Z")

</div>

> [@zmattr](#):
>
> 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?

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.

---

<div class="post-metadata">

### Author: ![zmattr](https://talk.remobjects.com/user_avatar/talk.remobjects.com/zmattr/32/7989_2.png) [@zmattr](https://talk.remobjects.com/u/zmattr)
#### Post date: [July 17, 2018, 3:04pm UTC](https://talk.remobjects.com/t/unknown-namespace-errors-for-top-level-java-android-packages/16934/14 "2018-07-17T15:04:37Z")

</div>

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