NativeScript / android

NativeScript for Android using v8
https://docs.nativescript.org/guide/android-marshalling
Apache License 2.0
524 stars 134 forks source link

wrong native method signature called. #1645

Open farfromrefug opened 3 years ago

farfromrefug commented 3 years ago

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 commented 2 years ago

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 commented 1 year ago

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