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

Proguard/r8 instructions missing #1843

Open
mtotschnig opened this issue Apr 18, 2023 · 3 comments
Open

Proguard/r8 instructions missing #1843

mtotschnig opened this issue Apr 18, 2023 · 3 comments

Comments

@mtotschnig
Copy link

mtotschnig commented Apr 18, 2023

From the Readme, I am following Setup Instructions, then Android. Here it says "pay special attention to the Android instructions for ProGuard." but the referenced Proguard section does not exist.
I have been using this library with R8 successfully in the past, but recently tried out full mode, and got following exception:

Non-fatal Exception: java.lang.ExceptionInInitializerError:
       at java.lang.Class.newInstance(Class.java)
       at com.google.api.client.util.Types.newInstance(Types.java:113)
       at com.google.api.client.util.Data.newMapInstance(Data.java:550)
       at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:766)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:360)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:335)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:79)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:73)
       at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:460)
       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:603)
       at org.totschnig.drive.sync.DriveServiceHelper.getFile(DriveServiceHelper.java:143)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.requireBaseFolder(GoogleDriveBackendProvider.kt:403)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.<init>(GoogleDriveBackendProvider.kt:420)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:19)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.from-0E7RQCE(SyncBackendProviderFactory.kt:18)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.access$from-0E7RQCE(SyncBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory$Companion.get-0E7RQCE(SyncBackendProviderFactory.kt:41)
       at org.totschnig.myexpenses.sync.SyncAdapter.onPerformSync(SyncAdapter.kt:123)
       at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:354)

Caused by java.lang.IllegalArgumentException: unable to create new instance of class kc.a because it is abstract and because it has no accessible default constructor
       at com.google.api.client.util.Types.handleExceptionForNewInstance(Types.java:162)
       at com.google.api.client.util.Types.newInstance(Types.java:117)
       at com.google.api.client.util.Data.createNullInstance(Data.java:166)
       at com.google.api.client.util.Data.nullOf(Data.java:134)
       at com.google.api.services.drive.model.File.<clinit>(File.java:69)
       at java.lang.Class.newInstance(Class.java)
       at com.google.api.client.util.Types.newInstance(Types.java:113)
       at com.google.api.client.util.Data.newMapInstance(Data.java:550)
       at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:766)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:360)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:335)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:79)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:73)
       at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:460)
       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:603)
       at org.totschnig.drive.sync.DriveServiceHelper.getFile(DriveServiceHelper.java:143)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.requireBaseFolder(GoogleDriveBackendProvider.kt:403)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.<init>(GoogleDriveBackendProvider.kt:420)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:19)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.from-0E7RQCE(SyncBackendProviderFactory.kt:18)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.access$from-0E7RQCE(SyncBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory$Companion.get-0E7RQCE(SyncBackendProviderFactory.kt:41)
       at org.totschnig.myexpenses.sync.SyncAdapter.onPerformSync(SyncAdapter.kt:123)
       at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:354)

Caused by java.lang.InstantiationException: java.lang.Class<kc.a> cannot be instantiated
       at java.lang.Class.newInstance(Class.java)
       at com.google.api.client.util.Types.newInstance(Types.java:113)
       at com.google.api.client.util.Data.createNullInstance(Data.java:166)
       at com.google.api.client.util.Data.nullOf(Data.java:134)
       at com.google.api.services.drive.model.File.<clinit>(File.java:69)
       at java.lang.Class.newInstance(Class.java)
       at com.google.api.client.util.Types.newInstance(Types.java:113)
       at com.google.api.client.util.Data.newMapInstance(Data.java:550)
       at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:766)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:360)
       at com.google.api.client.json.JsonParser.parse(JsonParser.java:335)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:79)
       at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:73)
       at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:460)
       at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:603)
       at org.totschnig.drive.sync.DriveServiceHelper.getFile(DriveServiceHelper.java:143)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.requireBaseFolder(GoogleDriveBackendProvider.kt:403)
       at org.totschnig.drive.sync.GoogleDriveBackendProvider.<init>(GoogleDriveBackendProvider.kt:420)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:19)
       at org.totschnig.drive.sync.GoogleDriveBackendProviderFactory.fromAccount(GoogleDriveBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.from-0E7RQCE(SyncBackendProviderFactory.kt:18)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory.access$from-0E7RQCE(SyncBackendProviderFactory.kt:12)
       at org.totschnig.myexpenses.sync.SyncBackendProviderFactory$Companion.get-0E7RQCE(SyncBackendProviderFactory.kt:41)
       at org.totschnig.myexpenses.sync.SyncAdapter.onPerformSync(SyncAdapter.kt:123)
       at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:354)
@suztomo
Copy link
Member

suztomo commented May 15, 2023

Would you share the background of the problem? Which Google service were you trying to use?

@mtotschnig
Copy link
Author

@suztomo Sorry for not following-up. I am using the Google Drive API, and was able to fix the problem by adding

-keep class com.google.api.services.drive.model.** { *; }

So the crash I mentioned does not belong here, but my point about the misleading documentation seems still valid to me.

@suztomo
Copy link
Member

suztomo commented Feb 20, 2024

Thank you for update. Glad to hear you've resolved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants