Mobile SDK Null Pointer Exception Workaround

We've had some reports that people are seeing a null pointer exception in Andrdoid apps build with the Connect IQ Mobile SDK when calling:

mConnectIQ.registerForAppEvents(mDevice, mMyApp, this);

at com.garmin.android.apps.connectmobile.connectiq.IConnectIQService$Stub$Proxy.registerApp(IConnectIQService.java:380)
at com.garmin.android.connectiq.ConnectIQDeviceStrategy.registerForRemoteAppEvents(ConnectIQDeviceStrategy.java:297)
at com.garmin.android.connectiq.ConnectIQ.registerForAppEvents(ConnectIQ.java:604)


UPDATE:

We have a new version 1.2 of the Android Mobile SDK up and available for download on the developer site, which contains a fix for the null pointer exception issue:

https://developer.garmin.com/connect-iq/sdk/
  • Former Member
    Former Member over 8 years ago
    Offered workaround didn't help to resolve issue, Android application still crashes and new companion app built from scratch with all ConnectIQ calls hidden within try/catch cannot deliver message due to inability to recognize device status. Please, revert GCM version to 3.10 on Google Play or or provide official link to download it.

    Here's full info
    10-17 15:30:41.299 3734-3807/? W/Binder: Caught a RuntimeException from the binder stub implementation.
    java.lang.NullPointerException: name == null
    at java.lang.Enum.valueOf(Enum.java:189)
    at com.garmin.android.connectiq.IQDevice$a.valueOf(SourceFile:24)
    at com.garmin.android.connectiq.IQDevice.<init>(SourceFile:84)
    at com.garmin.android.connectiq.c.createFromParcel(SourceFile:2053)
    at com.garmin.android.apps.connectmobile.connectiq.bp$a.onTransact(SourceFile:114)
    at android.os.Binder.execTransact(Binder.java:453)

    line 84 refers to IQDevice.class
    public IQDevice(Parcel in) {
    this.status = IQDevice.IQDeviceStatus.UNKNOWN;
    this.deviceIdentifier = in.readLong();
    this.friendlyName = in.readString();

    try {
    this.status = IQDevice.IQDeviceStatus.valueOf(in.readString()); // this line
    } catch (IllegalArgumentException var3) {
    this.status = IQDevice.IQDeviceStatus.UNKNOWN;
    }

    }


    Android companion also crashes on
    if (iqApp.getStatus() == IQApp.IQAppStatus.INSTALLED) {
    }


    It seems, that with latest GCM all of the getStatus() methods are completely messed up, according to the stack traces this is due to updated parcel structure, which requires relevant updates in connectiq.jar.
  • Former Member
    Former Member over 8 years ago
    Can someone from Garmin, please, provide some ETA for solution of this problem? It's been a week since Android GCM v3.11 release and there are already a lot of bad user reviews related to this specific GCM version itself on Google Play let alone the third-party app communication problems.

    We can fix mobile application crashes no problem, but communications channel still doesn't work even using offered workaround since device and application statuses are not returned correctly so it's unknown whether devices are connected and applications installed. I've found myself using GCM v3.10 from semi-reliable source as a temporary fix, but I cannot recommend users to search web for apk and install applications from untrusted forums...

    If current GCM parcel structures are final and won't be changed in future, then it would be nice if updated connectiq.jar is released for the developers to update their companion programs.
    Please, do not let this problem to be forgotten, because it's serious issue.
  • Former Member
    Former Member over 8 years ago
    Please provide fix

    I have the same issue: sending/receiving messages does not work!
    registerForAppEvents() crashes

    Please provide fix in connectiq.jar or GCM
  • Hey Everyone,

    Thank you so much for your patience. I wanted to let you know that the ticket to address this issue is actively being worked on. Though I can't give any exact ETA it is likely that the fix will be in place soon.

    -Coleman
  • Former Member
    Former Member over 8 years ago
    Developer status update: after latest Forerunner FW 6.30 installation I lost ability to communicate with the device even using GCM v3.10, things got back to normal after GCM v3.10 reinstallation and pairing with the device once again. Latest GCM v3.11 gives the same problems as before: no device/application status can be retrieved.

    Currently there's still only one solution until either connectIQ.jar or GCM is updated by Garmin: use GCM v3.10.
  • Former Member
    Former Member over 8 years ago
    Developer status update: after latest Forerunner FW 6.30 installation I lost ability to communicate with the device even using GCM v3.10, things got back to normal after GCM v3.10 reinstallation and pairing with the device once again. Latest GCM v3.11 gives the same problems as before: no device/application status can be retrieved.

    Currently there's still only one solution until either connectIQ.jar or GCM is updated by Garmin: use GCM v3.10.


    I am waiting for this to be fixed :-(
    The only question is: where to download GCM v3.10?
  • Everyone,

    It appears that the workaround is not working for many. I wanted to give you an update so everyone is aware that we know and are working to get solutions in place.

    Thank you,
    -Coleman
  • We have a new version 1.2 of the Android Mobile SDK up and available for download on the developer site, which contains a fix for the null pointer exception issue:

    https://developer.garmin.com/connect-iq/sdk/

    We apologize that the work-around we posted previously wasn't effective for most of you, but appreciate everyone hanging in there while we worked out a solution for this.
  • Former Member
    Former Member over 8 years ago
    GCM fatal error

    I tried 1.2 mobile sdk, but GCM output next error and down when fenix3 request makeImageRequest.

    11-10 11:55:54.298 20597-21967/? E/dalvikvm: Could not find class 'com.garmin.monkeybrains.a.a.a.a.a$d[]', referenced from method com.garmin.android.apps.connectmobile.connectiq.y.a
    11-10 11:55:55.688 20597-21967/? E/AndroidRuntime: FATAL EXCEPTION: Thread-72350
    Process: com.garmin.android.apps.connectmobile, PID: 20597
    java.lang.IllegalAccessError: tried to access class com.garmin.monkeybrains.a.a.a.a.a$d[] from class com.garmin.android.apps.connectmobile.connectiq.y
    at com.garmin.android.apps.connectmobile.connectiq.y.a(SourceFile:2111)
    at com.garmin.android.apps.connectmobile.gfdi.protobuf.HttpProtobufRequestHandler.makeImageRequest(SourceFile:1701)
    at com.garmin.android.apps.connectmobile.gfdi.protobuf.HttpProtobufRequestHandler.run(SourceFile:1180)
    at java.lang.Thread.run(Thread.java:841)
  • I tried 1.2 mobile sdk, but GCM output next error and down when fenix3 request makeImageRequest.

    11-10 11:55:54.298 20597-21967/? E/dalvikvm: Could not find class 'com.garmin.monkeybrains.a.a.a.a.a$d[]', referenced from method com.garmin.android.apps.connectmobile.connectiq.y.a
    11-10 11:55:55.688 20597-21967/? E/AndroidRuntime: FATAL EXCEPTION: Thread-72350
    Process: com.garmin.android.apps.connectmobile, PID: 20597
    java.lang.IllegalAccessError: tried to access class com.garmin.monkeybrains.a.a.a.a.a$d[] from class com.garmin.android.apps.connectmobile.connectiq.y
    at com.garmin.android.apps.connectmobile.connectiq.y.a(SourceFile:2111)
    at com.garmin.android.apps.connectmobile.gfdi.protobuf.HttpProtobufRequestHandler.makeImageRequest(SourceFile:1701)
    at com.garmin.android.apps.connectmobile.gfdi.protobuf.HttpProtobufRequestHandler.run(SourceFile:1180)
    at java.lang.Thread.run(Thread.java:841)


    Hello,

    I have done some investigation on this issue for you. It looks like your problem in particular has something to do with the Garmin Connect Mobile side of things. I have moved a ticket into their queue to be investigated.

    -Coleman