Cannot build realm with 5.8.0
Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Realm version(s): ?
5.8.0
Realm Sync feature enabled: Yes/No
Android Studio version: ?
3.2.1
Android Build Tools version: ?
28
Gradle version: ?
3.2.1
Which Android version and device(s): ?
21
It works when I change realm version to 5.7.0 or minSdkVersion 26.
Hey - looks like you forgot to add a T:* label - could you please add one?
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Solved!
Hmm, this shouldn't be required. So even though it is a workaround we don't want to require it.
hmm i get the error too with 5.8.0, i was downgrading to 5.7.0 and worked
Some more error details in case it helps:
Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Caused by: com.android.tools.r8.utils.AbortException: Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/mgr/.gradle/caches/transforms-1/files-1.1/realm-android-library-5.8.0.aar/c7f823427f262f54101fbb84c4c4ac4a/jars/classes.jar
For those interested, the error is explained here: https://developer.android.com/studio/write/java8-support
Desugar currently doesn't support MethodHandle.invoke or MethodHandle.invokeExact. If your source code or one of your module dependencies use one of these methods you need to specify minSdkVersion 26 or higher. Otherwise, you get the following error:
Dex: Error converting bytecode to dex:
Cause: signature-polymorphic method called without --min-sdk-version >= 26In some cases, your module may not be using the invoke or invokeExact methods even when they're included in a library dependency. So, to keep using that library with minSdkVersion 25 or lower, enable code shrinking to remove unused methods. If that doesn't work, consider using an alternative library that doesn't use the unsupported methods.
The workaround of enabling Java 1.8 in the project is working for us. I didn't want to enable code shrinking in a debug build, but that might be another workaround based on the description above.
Can realm fix this 1.8 dependency? We want to use D8 but not R8 yet 1.8 requires R8 set to true in a chicken and egg loop.
diegomontoya I think you are mistaken about 1.8 requiring R8. The Android Studio 3.2 release notes say,
You can start using the preview version of R8 by including the following in your project’s gradle.properties file:
android.enableR8 = true
I have 1.8 enabled and only get the following warning if I specifically enable R8.
The option setting 'android.enableR8=true' is experimental and unsupported.
The current default is 'false'
Consider disabling R8 by removing 'android.enableR8=true' from your gradle.properties before publishing your app.
@jk77 If you want to use R8, you need to at least use Android 3.3RC2 which has updated R8 in beta form.
Run your probject in AS 3.3 and you will get desugaring requirements requires R8 to be enabled.
We have not tested using AS 3.2 as R8 in that build is not the latest.
@jk77 Looks like the error is buildconfig dependend. I can no longer reproduce the R8 desugaring requirement error from AS 3.3rc2. Must be some thing I have chagend in build.gradle within the last 24 hours.
The Java 8 code has been removed (lamdas) and a fix should be in the next release.
Try to decrease version of Google Cloud dependency if you are using
Try to decrease version of Google Cloud dependency if you are using
afridi315 have tried downgrading from 1.22.1 to 1.20.0 option but now it is giving More than one file was found with OS independent path 'META-INF/INDEX.LIST'
how can i get the realm
@victorhez you might want to open a new issue, that obeys the issue template when you open a new issue.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
in build Gradle of the app module
Most helpful comment
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Solved!