Search code examples
androidandroid-studiokotlinbuildbuild-error

"Unexpected attempt to get register for a value without a register" during release builds but not debug


Debug builds work fine for me. When I choose Active Build Variant = release, and try to run Build -> Generate Bundle(s) / APK(s) -> Build APK, the build runs for a while, then I get the following error:

Unexpected attempt to get register for a value without a register in method java.util.List com.chrynan.chords.parser.AsciiChordParser.parseLineAsString(java.lang.String, int, java.util.Set).

That is referencing an external library I'm pulling in. Source code for that function is available here.

What does that error mean? My searches returned nothing remotely like it.


Solution

  • I solved it! I have no idea why, but I set minifyEnabled = true in my build.gradle (:app):

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    

    This gave me instant crashing on app start due to this problem, although I think that's unrelated. I fixed that, and now my build works.

    I still have no idea why that error came up though.