I'm trying to add K2 Compiler Support in my Androi...
# k2-adopters
s
I'm trying to add K2 Compiler Support in my Android Project but getting error when I'm trying to run
./gradlew build
. In thread adding stacktrace for info regarding the exception.
Task datalintReportDebug
Wrote HTML report to file:///Users/swapnilmusale/StudioProjects/JetJoke/data/build/reports/lint-results-debug.html
Task datalintDebug FAILED
/Users/swapnilmusale/StudioProjects/JetJoke/data: Error: Unexpected failure during lint analysis (this is a bug in lint or one of the libraries it depends on) Message: Protocol message contained an invalid tag (zero). Stack: InvalidProtocolBufferException:InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:89)←CodedInputStream.readTag(CodedInputStream.java:158)←JvmModuleProtoBuf$Module.<init>(JvmModuleProtoBuf.java:223)←JvmModuleProtoBuf$Module.<init>(JvmModuleProtoBuf.java:188)←JvmModuleProtoBuf$Module$1.parsePartialFrom(JvmModuleProtoBuf.java:341)←JvmModuleProtoBuf$Module$1.parsePartialFrom(JvmModuleProtoBuf.java:336)←AbstractParser.parsePartialFrom(AbstractParser.java:192)
y
Are you using the new k2 uast in agp 8.2+?
s
Android Gradle Plugin : 8.1.1 Gradle Version : 8.3 Android Studio Version : Giraffe | 2022.3.1 Patch 1
y
You might try
android.lint.useK2Uast=true
mentioned here
but there are still plenty of lint bugs related to K2 https://issuetracker.google.com/issues?q=K2%20Lint%20analysis%20error
s
Currently using AGP 8.1.1 for this version
android.lint.useK2Uast=true
not supported.
y
yeah it’s only available in 8.2, but you can still report the issue
s
Yea I have reported the issue waiting for reply on it https://issuetracker.google.com/issues/298297286
👍 1
y
In the mean time you can test just the compilation by running
./gradlew assembleDebug
or something
s
app deployment task works perfectly through run button or command But if I try to run
./gradlew build
command then its getting failed with exception As my CI workflow depends upon build command
y
you need to skip lint for now if you want to run
./gradlew build
s
Ok How can I do the same have any idea ?
Seems this is the way to go Correct me if wrong
Copy code
android {
    lintOptions {
        checkReleaseBuilds false
        //If you want to continue even if errors found use following line
        abortOnError false
    }
}
y
or
./gradlew build -x lint
it’s up to you, I prefer making it obvious something is wrong and should be fixed later.
abortOnError
might conflate both k2 and non-k2 related lint issues
👍 1
s
OK Thanks for your ans
👍 1