"expo-location:compileReleaseJavaWithJavac" error while building application using EAS build

Viewed 476

Good day.
I am new in React Native and when I want to build my app, I am facing following error:

[stderr] /home/expo/workingdir/build/node_modules/expo-location/android/src/main/java/expo/modules/location/taskConsumers/LocationTaskConsumer.java:235: error: cannot find symbol

[stderr]       extras.putString("appId", mTask.getAppScopeKey());

[stderr]                                      ^

[stderr]   symbol:   method getAppScopeKey()

[stderr]   location: variable mTask of type TaskInterface

[stderr] Note: /home/expo/workingdir/build/node_modules/expo-location/android/src/main/java/expo/modules/location/taskConsumers/GeofencingTaskConsumer.java uses unchecked or unsafe operations.

[stderr] Note: Recompile with -Xlint:unchecked for details.

[stderr] 1 error

[stderr] FAILURE: Build failed with an exception.

[stderr] * What went wrong:

[stderr] Execution failed for task ':expo-location:compileReleaseJavaWithJavac'.

[stderr] > Compilation failed; see the compiler error output for details.

[stderr] * Try:

[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan

[stderr] to get full insights.

[stderr] * Get more help at https://help.gradle.org

[stderr] BUILD FAILED in 4m 34s

My eas.json file looks like this:

{
  "cli": {
    "version": ">= 0.52.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "android": {
        "buildType": "apk"
      },
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

In some sources, it was said that changing the build server image to "latest" will solve the problem. But it didn't.
How can I overcome this problem?

1 Answers

I later found the answer frawen. You need to add the latest image of your jdk version in your eas.json

This was mine:

{
  "cli": {
    "version": ">= 0.54.1"
  },
  "build": {
    "development": {
      "env":{
        "ANDROID_SDK_ROOT": "C:/Users/user/AppData/Local/Android/Sdk"
      },
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "image": "ubuntu-18.04-jdk-11-ndk-r19c"
      }
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

You can use the same image (ubuntu-18.04-jdk-11-ndk-r19c) as mine as far as your jdk version is equal or above 11.

Related