android icon indicating copy to clipboard operation
android copied to clipboard

wrong native method signature called.

Open farfromrefug opened this issue 5 years ago • 2 comments

I found an issue with runtime which actually calls the wrong method on android. this the method https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.GpsStatus.NmeaListener) That method changed in 24 and now use that signature https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener) The issue is that in both cases the parameter is actually a java.lang.Object. And the runtime actually always chooses this one even on pre 24 => crash. We discovered that issue in my gps plugin here and the actual crash happens here https://github.com/nativescript-community/gps/blob/b3fe1d032cb3e5b6f7b76f1cf62926fdab6d0baa/src/gps.android.ts#L456

farfromrefug avatar Nov 06 '20 08:11 farfromrefug

I am facing this issue again. It seems the runtime does not know which method to access when you have something like:

class Toto {
 public void add(float[] points); 
 public void add(java.nio.FloatBuffer points);
}

Wondering if both signatures are in the metadata. @darind would you have an idea? EDIT: i feel like it comes from this https://github.com/NativeScript/android-runtime/pull/1577. The new test added to ignore methods only look for method names and does not compare arguments signature

farfromrefug avatar Sep 28 '21 19:09 farfromrefug

@triniwiz @edusperoni do you think this one is fixed with the latest changes for metadata?

farfromrefug avatar Oct 29 '22 19:10 farfromrefug