Alex40 5 Posted October 14, 2022 (edited) I am trying to use my App with Android Service for Location running in the background. App crashes after service is being started, I see the following error in the Log cat: 10-14 11:12:45.861: E/AndroidRuntime(30933): com.embarcadero.rtl.NativeDispatchException: Invoke error: method 'onLocationChanged(Ljava/util/List;)V' not found 10-14 11:12:45.861: E/AndroidRuntime(30933): at com.embarcadero.services.LocationServiceProxyInterface.dispatchToNative2(Native Method) 10-14 11:12:45.861: E/AndroidRuntime(30933): at com.embarcadero.services.LocationServiceProxyInterface.invoke(LocationServiceProxyInterface.java:26) I found out that another person was struggling with the same issue after upgrading from Rad Studio 11 to 11.1 and after regenerated the new .java files: https://stackoverflow.com/questions/72807321/android-12-on-locationchanged-has-invalid-location Unfortunately there is no answer / fix to his report about this error. I tried a lot ot things but nothing helped fixing this issue. This issue is happening on Android 12. Android 10 is working fine (not tested on Android 11). If I upgrade to Rad Studio 11.2 is it possible to fix this issue? ------------------------------------------------------------ Another question: Is it mandatory to target sdk version 31 (with exported=true) in the android manifest template if I want to run fully compatible app on Android 12? Because after I put 31 in the target sdk version (with exported=true), my app is built but can't be installed on the device after that. The error that the .apk file throws is: Error parsing the file. (Same thing happens on Android 10 device) Any help would be higly appreciated! Thank you in advance ! Edited October 14, 2022 by Alex40 Share this post Link to post
Dave Nottage 557 Posted October 14, 2022 3 hours ago, Alex40 said: If I upgrade to Rad Studio 11.2 is it possible to fix this issue? Yes, the issue is fixed in 11.1, so 11.2 also has the fix. 3 hours ago, Alex40 said: Is it mandatory to target sdk version 31 (with exported=true) in the android manifest template if I want to run fully compatible app on Android 12? It's only mandatory if publishing to the Play Store. 3 hours ago, Alex40 said: The error that the .apk file throws is: Error parsing the file. (Same thing happens on Android 10 device) It should report the line/char that it fails on, so you should be able to tell where the problem is Share this post Link to post
Alex40 5 Posted October 15, 2022 (edited) 21 hours ago, Dave Nottage said: Yes, the issue is fixed in 11.1, so 11.2 also has the fix. I am already with Rad Studio 11.1, but I am still getting this error: com.embarcadero.rtl.NativeDispatchException: Invoke error: method 'onLocationChanged(Ljava/util/List;)V' not found Edited October 15, 2022 by Alex40 Share this post Link to post
Dave Nottage 557 Posted October 15, 2022 10 hours ago, Alex40 said: I am already with Rad Studio 11.1, but I am still getting this error: Are you using TLocationSensor? That's where it was fixed. If you're attempting to use JLocationListener on its own, you'll need to modify the class that implements it, such as in the Unit14.pas attachment, here: https://quality.embarcadero.com/browse/RSP-39566 Share this post Link to post
Alex40 5 Posted October 17, 2022 On 10/15/2022 at 10:28 PM, Dave Nottage said: Are you using TLocationSensor? That's where it was fixed. If you're attempting to use JLocationListener on its own, you'll need to modify the class that implements it, such as in the Unit14.pas attachment, here: https://quality.embarcadero.com/browse/RSP-39566 I am using JLocationListener. Your modifications definitely fixed my issue, as described in the Embarcadero Thread. Thank you very much! 1 Share this post Link to post