I've got the below problem when trying to build a React Native android app from command line. It is on Ubuntu Server so no Android Studio GUI.
I do have android-28
installed in the folder which the error states.
$ANDROID_HOME
is at /home/build/android-tools
build@v-ope-we-build-vm:~/Awesome/android$ ./gradlew assembleRelease --scan
> Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in /home/build/android-tools/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in /home/build/android-tools/build-tools/28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.
Checking the license for package Android SDK Platform 28 in /home/build/android-tools/licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
"Install Android SDK Platform 28 (revision: 6)" ready.
Installing Android SDK Platform 28 in /home/build/android-tools/platforms/android-28
"Install Android SDK Platform 28 (revision: 6)" complete.
"Install Android SDK Platform 28 (revision: 6)" finished.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find target with hash string 'android-28' in: /home/build/android-tools
* Try:
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 17s
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no]
yes
Gradle Terms of Service accepted.
Publishing build scan...
https://gradle.com/s/na57rru4ztmpw
EDIT: sdkmanager output
build@v-ope-we-build-vm:~/android-tools$ sdkmanager --list
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;28.0.3 | 28.0.3 | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/
platform-tools | 28.0.2 | Android SDK Platform-Tools | platform-tools/
platforms;android-28 | 6 | Android SDK Platform 28 | platforms/android-28/
sources;android-28 | 1 | Sources for Android 28 | sources/android-28/