Android build fails, and I don't understand what should I do about it

Hello, I am using UE 4.25.4 on my shiny Ubuntu 18.04 with 4.15.0-128-generic kernel.
Except frequent crashes on autosaving, it works fine and I can package “Linux” packages reliably.
I’ve installed android studio 3.5.3 with SDK 28 and NDK 20 and run SetupAndroid.sh (which installed NDK 21).
And now, when I try to package the project for Android, it fails with this:

UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)):   ERROR: /bin/sh failed with args -c '"<path>/UnrealProjects/<name>/Intermediate/Android/armv7/gradle/gradlew" :app:assembleDebug'
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Took 4849,006764s to run mono, ExitCode=6
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): UnrealBuildTool failed. See log for more details. (<home>/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-<name>-Android-Shipping.txt)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): AutomationTool exiting with ExitCode=6 (6)
PackagingResults: Error: /bin/sh failed with args -c '"<path>/UnrealProjects/<name>/Android/armv7/gradle/gradlew" :app:assembleDebug'
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): RunUAT ERROR: AutomationTool was unable to run successfully.
PackagingResults: Error: AutomationTool was unable to run successfully.
PackagingResults: Error: Unknown Error

UBT–Android-Shipping.txt have this suspicous part near its end:

UEDeployAndroid.RunCommandLineProgramWithException: Fix gradlew permissions
UEDeployAndroid.RunCommandLineProgramWithExceptionAndFiltering: Making .apk with Gradle...
UEDeployAndroid.FilterStdOutErr: To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html.
UEDeployAndroid.FilterStdOutErr: Daemon will be stopped at the end of the build stopping after processing
UEDeployAndroid.FilterStdOutErr: > Task :app:preBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :app:preDebugBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:preBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:preDebugBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:compileDebugAidl NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :permission_library:preBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :permission_library:preDebugBuild UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :permission_library:compileDebugAidl NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :app:compileDebugAidl UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:packageDebugRenderscript NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :permission_library:packageDebugRenderscript NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :app:compileDebugRenderscript NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :app:checkDebugManifest UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :app:generateDebugBuildConfig UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:compileDebugRenderscript NO-SOURCE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:checkDebugManifest UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:generateDebugBuildConfig UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:generateDebugResValues UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:generateDebugResources UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:packageDebugResources UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:parseDebugLibraryResources UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:processDebugManifest UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:generateDebugRFile UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:javaPreCompileDebug UP-TO-DATE
UEDeployAndroid.FilterStdOutErr: > Task :downloader_library:compileDebugJavaWithJavac FAILED
UEDeployAndroid.FilterStdOutErr: 
UEDeployAndroid.FilterStdOutErr: FAILURE: Build failed with an exception.
UEDeployAndroid.FilterStdOutErr: 
UEDeployAndroid.FilterStdOutErr: * What went wrong:
UEDeployAndroid.FilterStdOutErr: Execution failed for task ':downloader_library:compileDebugJavaWithJavac'.
UEDeployAndroid.FilterStdOutErr: > Could not find tools.jar. Please check that /usr/lib/jvm/jre1.8.0_221 contains a valid JDK installation.
UEDeployAndroid.FilterStdOutErr: 
UEDeployAndroid.FilterStdOutErr: * Try:
UEDeployAndroid.FilterStdOutErr: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
UEDeployAndroid.FilterStdOutErr: 
UEDeployAndroid.FilterStdOutErr: * Get more help at https://help.gradle.org
UEDeployAndroid.FilterStdOutErr: 
UEDeployAndroid.FilterStdOutErr: BUILD FAILED in 21s

/usr/lib/jvm/jre1.8.0_221 does seem to contain a valid Java installation
I feel stuck T_T
Please guide me a bit