Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The wrong version of sourceCompatibility and targetCompatibility is being used #8

Open
Newbie-Alfi opened this issue Feb 3, 2025 · 0 comments

Comments

@Newbie-Alfi
Copy link

Description

The switch expression is used in a project that is available with "14" versions of java, but in "build.gradle" version "1.8" is specified.

// android/build.gradle
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

Error message:

> Task :appmetrica_react-native-analytics:compileDebugJavaWithJavac FAILED
/home/develop/Desktop/projects/modile-init/open/mobile/node_modules/@appmetrica/react-native-analytics/android/src/main/java/io/appmetrica/analytics/reactnative/ExternalAttributionSerializer.java:19: error: switch expressions are not supported in -source 8
        return switch (sourceString) {
               ^
  (use -source 14 or higher to enable switch expressions)
/home/develop/Desktop/projects/modile-init/open/mobile/node_modules/@appmetrica/react-native-analytics/android/src/main/java/io/appmetrica/analytics/reactnative/ExternalAttributionSerializer.java:20: error: switch rules are not supported in -source 8
            case "AppsFlyer" -> ModulesFacade.EXTERNAL_ATTRIBUTION_APPSFLYER;
                             ^
  (use -source 14 or higher to enable switch rules)
2 errors

FAILURE: Build failed with an exception.

Possible solution

Perhaps the best way to solve this error is to stop using the switch expression and leave java version 1.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant