Android Question FusedLocationProvider + Resolution Dialog - Error

samikinikar

Member
Licensed User
Longtime User
Using this example (https://www.b4x.com/android/forum/threads/fusedlocationprovider-resolution-dialog.111652/ ) as it is untouched, displays the following error, can anyone please guide me whats the issue ? line 26 is flp.Connect

B4X:
Logger connected to:  motorola moto e(7) plus
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 26 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1058)
    at b4a.example.loc.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1068)
    at b4a.example.loc.b4xpagesmanager._showpage(b4xpagesmanager.java:425)
    at b4a.example.loc.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
    at b4a.example.loc.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
    at b4a.example.loc.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
    at b4a.example.loc.main._activity_create(main.java:415)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at b4a.example.loc.main.afterFirstLayout(main.java:105)
    at b4a.example.loc.main.access$000(main.java:17)
    at b4a.example.loc.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:914)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:241)
    at android.app.ActivityThread.main(ActivityThread.java:7582)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    ... 24 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    ... 25 more
Caused by: java.lang.IncompatibleClassChangeError: Found class com.google.android.gms.common.api.GoogleApiClient, but interface was expected (declaration of 'com.google.android.gms.common.api.GoogleApiClient' appears in base.apk)
    at uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper.Connect(FusedLocationProviderWrapper.java:147)
    at b4a.example.loc.b4xmainpage._b4xpage_created(b4xmainpage.java:62)
    ... 27 more


Line 26 : flp.Connect
 
If you read that example thread you will find
Your SDK is probably out of date. Update to B4A 11.80 as well if you haven't already.
 
Upvote 1
Thank you for the update, well Iam already using B4A 11.80, the SDK once again download and replaced. then too same error.
Anyway I will check if any other things are missing from my end.
 
Upvote 0
I just tried the example and get the same error as you on Android 12, 1 ands .1 phones. Looks like something has broken the Fused Location library as I am certain that my B4A installation and SDK are correct.

The error is within the library itself and as far as I can see nothing to do with B4A and may be a dependency problem. I also note that it depends on the GPS library for its LocationWrapper class - whether this is part of the problem I have no idea.
 
Upvote 0
I just tried the example and get the same error as you on Android 12, 1 ands .1 phones. Looks like something has broken the Fused Location library as I am certain that my B4A installation and SDK are correct.

The error is within the library itself and as far as I can see nothing to do with B4A and may be a dependency problem. I also note that it depends on the GPS library for its LocationWrapper class - whether this is part of the problem I have no idea.

is this independent from the targetsdk setting in the manifest file?
just running on Android 12 triggers it?
 
Upvote 0
is this independent from the targetsdk setting in the manifest file?
just running on Android 12 triggers it?
As I have now typed correctly in my post above I have seen it in Android 12, 11 and 8.1 phones so I think it's a library incompatibility problem with something in the present SDK.
 
Upvote 0
I just checked one app of mine, that's using FLP on Android 11 and 12, and it runs correctly
I'm using android-30 as platform in SDK
How can I check my SDK version? I surely downloaded it from the B4A page, but I'm not sure it's the current one, since some time has passed
 
Upvote 0
I just checked one app of mine, that's using FLP on Android 11 and 12, and it runs correctly
Interesting. Have you recompiled it lately?
How can I check my SDK version
I don't know without just downloading a new one into a different folder and comparing it as when you unzip the SDK all the modified date are changed
 
Upvote 0
I just downloaded the FLP2 example from the first post, compiled and run it correctly on an Android 11 device
platform-tools from my SDK are the same as the ones just re-downloaded from the B4A installation page
I use C:\Android\platforms\android-30\android.jar in my path and that jar is the same as the installation page package
All the files in my C:\Android have timestamp 30/8/2020 as the ones in the zip package
 
Upvote 0
I also downloaded again command line tools and resources zip
FLP2 compiled and run without issues on Android 11 & 12 devices
B4A 11.8
 
Upvote 0
Back
Top