Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError: No virtual method isAssignableFrom() #976

Closed
barbeau opened this issue Apr 18, 2019 · 3 comments
Closed

java.lang.NoSuchMethodError: No virtual method isAssignableFrom() #976

barbeau opened this issue Apr 18, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Apr 18, 2019

Summary:

After doing the latest OneBusAway release build and updating from v2.4.4 to v2.5, I'm seeing a crash after updating the app, which seems to trigger a registration for Embedded Social push notifications (if you're logged in with an Embedded Social account).

Here's the stack trace:

2019-04-15 17:45:28.850 30037-30418/? E/AndroidRuntime: FATAL EXCEPTION: intent processor #2
    Process: com.joulespersecond.seattlebusbot, PID: 30037
    java.lang.NoSuchMethodError: No virtual method isAssignableFrom(Ljava/lang/reflect/Type;)Z in class Lcom/google/common/reflect/TypeToken; or its super classes (declaration of 'com.google.common.reflect.TypeToken' appears in base.apk)
        at com.microsoft.rest.Validator.validate(Validator.java:49)
        at com.microsoft.embeddedsocial.autorest.MyPushRegistrationsOperationsImpl.putPushRegistration(MyPushRegistrationsOperationsImpl.java:112)
        at com.microsoft.embeddedsocial.server.model.notification.RegisterPushNotificationRequest.send(RegisterPushNotificationRequest.java:38)
        at com.microsoft.embeddedsocial.data.storage.NotificationServiceCachingWrapper.registerPushNotification(NotificationServiceCachingWrapper.java:66)
        at com.microsoft.embeddedsocial.fcm.TokenSyncAdapter.synchronize(TokenSyncAdapter.java:44)
        at com.microsoft.embeddedsocial.server.sync.DataSynchronizer.synchronizeEntity(DataSynchronizer.java:94)
        at com.microsoft.embeddedsocial.server.sync.DataSynchronizer.synchronizeProducer(DataSynchronizer.java:70)
        at com.microsoft.embeddedsocial.server.sync.DataSynchronizer.synchronize(DataSynchronizer.java:42)
        at com.microsoft.embeddedsocial.service.handler.SynchronizationHandler.handleIntent(SynchronizationHandler.java:58)
        at com.microsoft.embeddedsocial.service.handler.SynchronizationHandler.handleIntent(SynchronizationHandler.java:24)
        at com.microsoft.embeddedsocial.base.service.IntentProcessor$IntentHandlerAdapter.run(IntentProcessor.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

When doing the release and trying to obfuscate via Proguard, I was getting the following warning that was blocking the build:

"Warning: com.microsoft.rest.Validator: can't find referenced method 'boolean isAssignableFrom(java.lang.reflect.Type)' in program class com.google.common.reflect.TypeToken"

So, in this commit I added the following to our Proguard rules:

-dontwarn com.microsoft.rest.Validator

This lets me build the project, but then results in the above runtime exception.

After talking with @acrown-msft it looks like the ES SDK uses a ES Java API library (https://github.com/Microsoft/EmbeddedSocial-Java-API-Library), which uses an older version of a REST library (https://github.com/Azure/autorest-clientruntime-for-java), which is using an older version of Guava (18). OBA Android is stripping out this older version of Guava in favor of v26, which is being used by Firebase and other OBA dependencies. As a result, we get a runtime error because this method doesn't existing in v26 of the Guava library. Additionally, all interactions with the ES server aren't functional.

@acrown-msft is going to look at updating the ES Java API library dependency to use a newer version of the REST library, which is using a newer version of Guava.

Steps to reproduce:

  1. Install v2.4.4 - https://github.com/OneBusAway/onebusaway-android/releases/tag/v2.4.4
  2. Log into EmbeddedSocial
  3. Install v2.5.0 - https://github.com/OneBusAway/onebusaway-android/releases/tag/v2.5.0
  4. Start up app

Expected behavior:

Not crash

Observed behavior:

It crashes, and all interactions with ES server aren't functional

Device, Android, and Embedded Social SDK version:

Samsung Galaxy S8+ w/ Android 9.0

@barbeau barbeau added the bug label Apr 18, 2019
@barbeau barbeau added this to the v2.5.x milestone Apr 18, 2019
@barbeau
Copy link
Member Author

barbeau commented Apr 18, 2019

I opened an issue on this on the ES SDK - microsoft/EmbeddedSocial-Android-SDK#119.

@barbeau
Copy link
Member Author

barbeau commented Jul 2, 2019

After repeating the repro steps in this issue I can confirm that the issue appears to be fixed with new release version v2.5.3.

@barbeau
Copy link
Member Author

barbeau commented Jul 2, 2019

FYI, with the re-packaged version of Guava in the new ES SDK release our total APK size only went up 0.03 MB.

barbeau pushed a commit to cagryInside/onebusaway-android that referenced this issue Jul 3, 2019
… collection feature

Fix OneBusAway#990 - Interpret alert end time of 0 as unending alert

Fix OneBusAway#976 Resolve Guava version conflicts in Embedded Social

Fix OneBusAway#943 Workaround for String.isEmpty() being broken in newer versions of Gradle

WIP Fix OneBusAway#875 - User-travel-behavior - Implement ignore battery optimizations feature

User-travel-behavior - Implement storing device information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants