Skip to content

Commit

Permalink
Fix error with minify when using AGP 8
Browse files Browse the repository at this point in the history
Adding a common -dontwarn for java.lang.invoke.StringConcatFactory, or for all
serialization classes does not solve the problem, but hide it in the serialization
itself, or in the unrelated code of other dependencies.

An alternative to using the -dontwarn in the ProGuard rules for building the library
is to turn off generation of invokedynamic for string concatenation for kotlinc when
building the with the option -Xstring-concat=inline.

AGP already turns off off generation of invokedynamic for string concatenation for javac.

Fixes:

> Task :appcore:minifyReleaseWithR8

ERROR: R8: Missing class java.lang.invoke.StringConcatFactory
(referenced from: void org.torproject.android.core.Languages.<init>(android.app.Activity)
and 1 other context)
  • Loading branch information
syphyr committed Jan 26, 2024
1 parent 7c55f01 commit 7ec449f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions appcore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ android {

kotlinOptions {
jvmTarget = '17'
freeCompilerArgs = ["-Xstring-concat=inline"]
}

namespace 'org.torproject.android.core'
Expand Down

0 comments on commit 7ec449f

Please sign in to comment.