Skip to content Skip to sidebar Skip to footer

Androidjavaproxy Is Not An Interface

I'm trying to use an Android phone's camera in Unity. I need to pass a CameraDevice.StateCallback to the CameraManager.openCamera method, which I have constructed as such: public c

Solution 1:

AndroidJavaProxy's constructor requires the fully qualified name string of the interface to be implemented for the callback. Presumably this is because the object passed back to you is a runtime constructed class, so its signature is not available at compile time, but that the code that constructs the runtime object can implement a given interface (how? I have no idea, other than it would use ASM, but that's like saying "I don't know how they made that dresser, but a saw was probably involved").

However, CameraDevice.StateCallback is not an interface, it is an abstract class.

The Unity example for using the AndroidJavaProxy uses a DatePickerDialog$OnDateSetListener callback interface, which we can see is actually an interface.

I am not sure what you should be doing instead (possibly subclassing CameraDevice.StateCallback? That's what this guy did) as I've never tried to do this, but that's why you're getting the error your getting.

Post a Comment for "Androidjavaproxy Is Not An Interface"