Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Android Binding Library 'package does not exist', 'cannot find symbol'

NicholasVentimigliaNicholasVentimiglia USMember ✭✭
edited January 2016 in Xamarin.Android

My solution has two Xamarin projects.

  • Websockets.Droid, a xamarin binding library.

  • Websockets.DroidTest, a xamarin android unit test project

The Websockets.Droid binding library has 2 jar files and one .cs file.

  • androidasync.jar, a websocket library file. this file is in the jar folder and is marked as 'EmbeddedReferenceJar', I do not want to expose this class to my C# projects, it is just here as a dependency. I have also tried 'ReferenceJar'

  • Websockets.DroidBridge.jar This java project has two very simple classes which are meant to act as a C# friendly interface for the androidasync library. This is an 'InputJar'.

The Websockets.Droid binding library builds fine. Moving on I referenced this binding library in my test project, and, it fails with the following errors.

I have two questions.

1) Why is it failing and how can I fix this.

2) Why do I see .java files ? The Jar files are compiled not 'source' jar files.

error: cannot find symbol
        if (getClass () == WebsocketConnectionDroid.class)
  symbol:   method getClass()
  location: class WebsocketConnectionDroid  Websockets.DroidTests   E:\Projects\Github\WebSockets.PCL\Websockets.DroidTests\obj\Debug\android\src\md5158179e487b6bdbd2eba69c7c4ae3833\WebsocketConnectionDroid.java 25  
 error: package websockets.DroidBridge does not exist
    extends websockets.DroidBridge.BridgeProxy  Websockets.DroidTests   E:\Projects\Github\WebSockets.PCL\Websockets.DroidTests\obj\Debug\android\src\md5158179e487b6bdbd2eba69c7c4ae3833\WebsocketConnectionDroid.java 5   

Answers

  • RenaudRenaud FRMember ✭✭

    thank you Nicolas !! saved my night !!

  • I had also faced the same issue, Thanks @NicholasVentimiglia for posting the solution, it helped me to fix the issue.
    I would also like to add here with your solution
    If anyone faces this issue, Please provide appropriate **Build Action ** for added Jar File,
    Click On the Jar --> Go to Properties --> Advanced --> Build Action --> EmbeddedJar(Select According to Jar)

Sign In or Register to comment.