Make the release (R8) build pass
Enabling R8 in the previous commit surfaced two build issues; fixed here so
assembleDebug AND assembleRelease both succeed (verified on this machine:
Android Studio JBR 21 + SDK android-36).
- proguard-rules.pro: add `-dontwarn com.google.errorprone.annotations.**`.
Tink (pulled in by androidx.security-crypto / EncryptedSharedPreferences)
references compile-only Error Prone annotations that aren't on the runtime
classpath, which R8 treated as fatal "missing class" errors.
- ApiClient.await(): @OptIn(ExperimentalCoroutinesApi::class) for the
resume(value){ onCancellation } overload (experimental in coroutines 1.8.1).
Release APK is R8-shrunk (~1.8 MB vs ~18 MB debug). It is unsigned — wire a
signing config / keystore (kept out of VCS) before distributing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
41098831ae
commit
af303d83c8
2 changed files with 7 additions and 0 deletions
5
app/proguard-rules.pro
vendored
5
app/proguard-rules.pro
vendored
|
|
@ -33,3 +33,8 @@
|
||||||
-dontwarn org.conscrypt.**
|
-dontwarn org.conscrypt.**
|
||||||
-dontwarn org.bouncycastle.**
|
-dontwarn org.bouncycastle.**
|
||||||
-dontwarn org.openjsse.**
|
-dontwarn org.openjsse.**
|
||||||
|
|
||||||
|
# ─── Tink / EncryptedSharedPreferences (androidx.security-crypto) ─────────────
|
||||||
|
# Tink references compile-only Error Prone annotations that aren't on the runtime
|
||||||
|
# classpath; they're not needed at runtime, so silence the missing-class errors.
|
||||||
|
-dontwarn com.google.errorprone.annotations.**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package no.svorka.mcms.core
|
package no.svorka.mcms.core
|
||||||
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.serialization.json.JsonElement
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
@ -24,6 +25,7 @@ import kotlin.coroutines.resumeWithException
|
||||||
private fun Response.closeQuietly() { runCatching { close() } }
|
private fun Response.closeQuietly() { runCatching { close() } }
|
||||||
|
|
||||||
/** Suspend bridge for an OkHttp call, with coroutine cancellation. */
|
/** Suspend bridge for an OkHttp call, with coroutine cancellation. */
|
||||||
|
@OptIn(ExperimentalCoroutinesApi::class) // resume(value) { onCancellation } overload
|
||||||
suspend fun Call.await(): Response = suspendCancellableCoroutine { cont ->
|
suspend fun Call.await(): Response = suspendCancellableCoroutine { cont ->
|
||||||
enqueue(object : Callback {
|
enqueue(object : Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue