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

Version 1.30.3 causes crash on Android < 8.0 when using FileDataStoreFactory from transitive google-http-java-client dependency #1382

Closed
alapshin opened this issue Sep 20, 2019 · 2 comments
Assignees
Labels
type: docs Improvement to the documentation for an API.

Comments

@alapshin
Copy link

alapshin commented Sep 20, 2019

Environment details

  1. OAuth2
  2. Android < 8.0 (API < 26)
  3. Java version:
  4. google-api-client version(s): 1.30.3

Steps to reproduce

  1. Update google-api-java-client to 1.30.3 (from 1.30.2)
  2. Try to create new instance of FileDataStore for AuthorizationCodeFlow.Builder
  3. Launch application on device with Android < 8.0
  4. Application crashes with attached stacktrace

Code example

new FileDataStoreFactory(new File(context.getFilesDir(), "credentials"))

Stack trace

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/nio/file/attribute/PosixFilePermission;
        at com.google.api.client.util.store.FileDataStoreFactory.setPermissionsToOwnerOnly(FileDataStoreFactory.java:141)
        at com.google.api.client.util.store.FileDataStoreFactory.<init>(FileDataStoreFactory.java:77)

Any additional information below

As far as I can tell is caused by following change in google-http-java-client:
googleapis/google-http-java-client#557 which was released as part of 1.31.0

Version 1.30.3 of google-api-client in turn pulls google-http-java-client 1.31.0:
#1347

As a result if application doesn't have explicit dependency on earlier version of google-http-java-client new version is used and it causes crash on devices with Android < 8.0 since NIO is not available until API 26.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Sep 21, 2019
@chingor13
Copy link
Collaborator

Unfortunately, you'll have to either lock your google-http-client to 1.30.2 or provide your own DataStoreFactory implementation. We will update the docs in google-http-client.

@chingor13 chingor13 added the type: docs Improvement to the documentation for an API. label Oct 11, 2019
@chingor13 chingor13 self-assigned this Oct 11, 2019
@yoshi-automation yoshi-automation removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Oct 11, 2019
@chingor13
Copy link
Collaborator

In com.google.http-client:google-http-client-android v1.36.0 we added back an Android-compatible FileDataStoreFactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Improvement to the documentation for an API.
Projects
None yet
Development

No branches or pull requests

3 participants