Open chrisdon opened 8 months ago
➤ PM Bot commented:
Jira ticket: RKOTLIN-1044
Sounds a bit like #1243 🤔
It's not clear what the solution to #1243 is. I tried updating the gradle version to 8.3 to align with the android plugin (8.2.2) but get the same result
It looks like the sample project @chrisdon provided (https://github.com/chrisdon/realm-kotlin-dex) compiles with warnings on Gradle 7.3.0:
AGPBI: {"kind":"warning","text":"Invalid stack map table at 94: aload 8, error: The expected type Initialized(long) is not assignable to java.lang.Object.","sources":[{"file":"/Users/obinns/.gradle/caches/transforms-3/d05239e3829165a5bd44713c4e82885e/transformed/instrumented_library-base-release-runtime.jar"}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Invalid stack map table at 97: ifnull L?, error: Could not assign '{0:Initialized(io.realm.kotlin.internal.RealmObjectHelper),1:Initialized(io.realm.kotlin.internal.RealmObjectReference),2:Initialized(java.lang.String),3:Initialized(io.realm.kotlin.types.BaseRealmObject),4:Initialized(io.realm.kotlin.UpdatePolicy),5:Initialized(java.util.Map),6:Initialized(int),7:Initialized(long),8:Initialized(long),10:Initialized(io.realm.kotlin.internal.RealmObjectHelper),11:Initialized(int)}' to '{0:Initialized(io.realm.kotlin.internal.RealmObjectHelper),1:Initialized(io.realm.kotlin.internal.RealmObjectReference),2:Initialized(java.lang.String),3:Initialized(io.realm.kotlin.types.BaseRealmObject),4:Initialized(io.realm.kotlin.UpdatePolicy),5:Initialized(java.util.Map),6:Initialized(int),7:Initialized(long),9:Initialized(io.realm.kotlin.internal.RealmObjectHelper),10:Initialized(int)}'. The local at index 9 with 'top' not being assignable to 'Initialized(io.realm.kotlin.internal.RealmObjectHelper)'.","sources":[{"file":"/Users/obinns/.gradle/caches/transforms-3/d05239e3829165a5bd44713c4e82885e/transformed/instrumented_library-base-release-runtime.jar"}],"tool":"D8"}
AGPBI: {"kind":"warning","text":"Invalid stack map table at 341: ifeq L?, error: Source locals {0:Initialized(androidx.compose.animation.core.ComplexDouble),1:Initialized(double),3:Initialized(double),5:Initialized(double),7:Initialized(boolean[]),8:Initialized(double),10:Initialized(double),12:Initialized(double),14:Initialized(double),16:Initialized(double),18:Initialized(double),19:Initialized(double),20:Initialized(double),21:Initialized(double),22:Initialized(double),23:Initialized(double)} have different local indices than {0:Initialized(androidx.compose.animation.core.ComplexDouble),1:Initialized(double),3:Initialized(double),5:Initialized(double),7:Initialized(boolean[]),8:Initialized(double),10:Initialized(double),12:Initialized(double),14:Initialized(double),16:Initialized(double),18:Initialized(double),20:Initialized(double),22:Initialized(double),24:top}.","sources":[{"file":"/Users/obinns/.gradle/caches/transforms-3/c1c4421df16fa9812bb4399f14ef0f3a/transformed/instrumented_animation-core-release-runtime.jar"}],"tool":"D8"}
This does not work on Gradle 7.4.0+ and fails the mergeExtDexDebug
step. It's possible that the stack map table warning is now treated as an error, though I can't see anything obvious in the Gradle 7.4 release notes..
How frequently does the bug occur?
-- select --
Description
Realm fails to compile when enableAndroidTestCoverage = true in a module or app level gradle file
This error can be avoided by setting isMinifyEnabled = true in buildTypes.debug section of the gradle file but I don't want to enable code shrinking for debug builds.
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
Create android project with: min version 29 Realm 1.14.0 kotlin 1.9.22 compose 1.5.10
See example here: https://github.com/chrisdon/realm-kotlin-dex
Version
1.14.0
What Atlas App Services are you using?
-- select --
Are you using encryption?
-- select --
Platform OS and version(s)
Android 10
Build environment
Android Studio version: 2023.1.1 Patch 2 Android Build Tools version: 34.0.0 Gradle version: 8.2