Reputation: 333
I have successfully migrated from V2 to V3 with my Android app. It works when I install it directly on the device via Android Studio, but when I install the APK manually or via Google Play Store, I get "Untitled" files for any create or upload, whether file or folder.
I use the Drive V3 API through the Java Client API Library https://developers.google.com/resources/api-libraries/documentation/drive/v3/java/latest/.
GoogleSignInOptions signInOptions =
new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestScopes(new Scope(DriveScopes.DRIVE_FILE))
.build();
GoogleSignInClient googleSignInClient = GoogleSignIn.getClient(mContext, signInOptions);
...
Drive googleDriveService =
new Drive.Builder(
AndroidHttp.newCompatibleTransport(),
new GsonFactory(),
credential)
.setApplicationName("Foo bar")
.build();
...
File folderMetaData = new File ()
.setName("test")
.setMimeType("application/vnd.google-apps.folder")
.setParents(Collections.singletonList("root"));
return mDriveService.files().create(folderMetaData)
.setFields("id, name")
.execute();
As I said, only changing the deployment from Android Studio install to a signed APK makes the create/upload not work any more. Any hints?
Upvotes: 1
Views: 564
Reputation: 196
Adding this to your proguard file should work:
-keep class * extends com.google.api.client.json.GenericJson {
*;
}
-keep class com.google.api.services.drive.** {
*;
}
Upvotes: 6