Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol 'Void'

At the head of my class (I am taking over a project from someone else), I have the following:

using Java.Util;
using Object = Java.Lang.Object;
using Void = Java.Lang.Void;

Void, is showing in red, with a "Cannot resolve symbol 'Void'" and cannot see what I may be missing.

I have checked the PC where this came from (and the application does build on that one) and have installed the same (yes, I saw, newer, but specifically installed the "same" items) Java items:

  • Java 7 Update 45
  • Java 6 Update 31
  • Java SE Development Kit 6 Update 31

This hasn't made any change.

I have checked the 'References' branch of the project and everything is showing the same (in fact, I cannot see a specific reference to Java anywhere)

Any help would be appreciated to sort this.

Please understand that I am not looking to change the code; just to get the code (as is) to compile without error.

[Update]

When I type out Java.Lang. the intellisense does not show Void in the dropdown list

[Further Update]

This project is tied to the development for a tablet; for which I hadn't installed some of the development software - installing these has resolved the issue and I can only assume that the Java namespace is buried within the software. Whilst there's no specific answer in the responses, most of the comments have certainly helped to steer me in the right direction.

like image 421
Sean Avatar asked Jan 09 '14 10:01

Sean


1 Answers

There are several possible ways a C# project consuming Java bits,

  • Microsoft J#, which has been dead for a long time.
  • IKVM.NET, which originates from Mono.
  • dot42, a C# to Android compiler, which compiles C# to Android.
  • Xamarin.Android (aka Mono.Android).

Based on the fragment you pasted I think you might be opening a Xamarin.Android project in Visual Studio, as the using clauses match,

http://androidapi.xamarin.com/?link=N%3aJava.Util

http://androidapi.xamarin.com/?link=T%3aJava.Lang.Void

http://androidapi.xamarin.com/?link=T%3aJava.Lang.Object

Thus, you need to have Xamarin.Android completely installed on this machine. What you have (JRE and JDK) is obviously not enough.

dot42 does not have Java.Lang.Void and Java.Lang.Object, http://docs.dot42.com/Reference/NS.Java.Lang

like image 75
Lex Li Avatar answered Oct 17 '22 07:10

Lex Li