expo / turtle

Standalone app builder service
MIT License
385 stars 29 forks source link

SDK 39 Android build fails because requested NDK version (21.0.6113669) not found #262

Closed peter-jozsa closed 3 years ago

peter-jozsa commented 3 years ago

New Issue Checklist

Issue Description

After upgrading our app to SDK39 turtle-cli fails to build it for Android. From the log output I think gradle misses version 21 of NDK.

Command executed
turtle build:android --public-url https://$STAFF_APP_RELEASE_PUBLIC_URL/android-index.json -o $ANDROID_BUNDLE_OUTPUT_PATH -t app-bundle --keystore-path ./staff-app.keystore --keystore-alias $EXPO_ANDROID_KEYSTORE_ALIAS --release-channel=$STAFF_APP_RELEASE_CHANNEL
Complete output when running turtle, including the stack trace and command used
1072Sep 22 20:19:06 turtle[61937] INFO:  Execution failed for task ':app:stripReleaseDebugSymbols'.
1073  platform: "android"
1074  buildPhase: "running gradle"
1075  source: "stderr"
1076Sep 22 20:19:06 turtle[61937] INFO:  > No version of NDK matched the requested version 21.0.6113669. Versions available locally: 17.2.4988734
1077  platform: "android"
1078  buildPhase: "running gradle"
1079  source: "stderr"
1080Sep 22 20:19:06 turtle[61937] INFO:  * Try:
1081  platform: "android"
1082  buildPhase: "running gradle"
1083  source: "stderr"
1084Sep 22 20:19:06 turtle[61937] INFO:  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.
1085  platform: "android"
1086  buildPhase: "running gradle"
1087  source: "stderr"
1088Sep 22 20:19:06 turtle[61937] INFO:  * Get more help at https://help.gradle.org
1089  platform: "android"
1090  buildPhase: "running gradle"
1091  source: "stderr"
1092Sep 22 20:19:06 turtle[61937] INFO:  BUILD FAILED in 8m 50s
1093  platform: "android"
1094  buildPhase: "running gradle"
1095  source: "stderr"
1096Sep 22 20:19:06 turtle[61937] INFO:  Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
1097  platform: "android"
1098  buildPhase: "running gradle"
1099  source: "stdout"
1100Sep 22 20:19:06 turtle[61937] INFO:  Use '--warning-mode all' to show the individual deprecation warnings.
1101  platform: "android"
1102  buildPhase: "running gradle"
1103  source: "stdout"
1104Sep 22 20:19:06 turtle[61937] INFO:  See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
1105  platform: "android"
1106  buildPhase: "running gradle"
1107  source: "stdout"
1108Sep 22 20:19:06 turtle[61937] INFO:  25 actionable tasks: 25 executed
1109  platform: "android"
1110  buildPhase: "running gradle"
1111  source: "stdout"
1112Sep 22 20:19:09 turtle[61937] ERROR: Error: ./gradlew exited with non-zero code: 1
1113    at ChildProcess.completionListener (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
1114    at Object.onceWrapper (events.js:422:26)
1115    at ChildProcess.emit (events.js:315:20)
1116    at ChildProcess.EventEmitter.emit (domain.js:483:12)
1117    at maybeClose (internal/child_process.js:1021:16)
1118    at Socket. (internal/child_process.js:443:11)
1119    at Socket.emit (events.js:315:20)
1120    at Socket.EventEmitter.emit (domain.js:483:12)
1121    at Pipe. (net.js:674:12)
1122    ...
1123    at spawnAsync (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
1124    at spawnAsyncThrowError (/@expo/xdl@57.9.35/src/detach/ExponentTools.ts:111:19)
1125    at buildShellAppAsync (/@expo/xdl@57.9.35/src/detach/AndroidShellApp.js:1412:11)
1126    at Object.createAndroidShellAppAsync (/@expo/xdl@57.9.35/src/detach/AndroidShellApp.js:370:5)
1127    at runShellAppBuilder (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:91:5)
1128    at buildAndroid (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:23:26)
1129    at /usr/local/lib/node_modules/turtle-cli/src/bin/utils/builder.ts:87:7
1130    at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:23:12)
1131  platform: "android"
1132Sep 22 20:19:09 turtle[61937] ERROR: Failed to build standalone app
1133  err: Error: ./gradlew exited with non-zero code: 1
1134      at ChildProcess.completionListener (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
1135      at Object.onceWrapper (events.js:422:26)
1136      at ChildProcess.emit (events.js:315:20)
1137      at ChildProcess.EventEmitter.emit (domain.js:483:12)
1138      at maybeClose (internal/child_process.js:1021:16)
1139      at Socket. (internal/child_process.js:443:11)
1140      at Socket.emit (events.js:315:20)
1141      at Socket.EventEmitter.emit (domain.js:483:12)
1142      at Pipe. (net.js:674:12)
1143      ...
1144      at spawnAsync (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
1145      at spawnAsyncThrowError (/@expo/xdl@57.9.35/src/detach/ExponentTools.ts:111:19)
1146      at buildShellAppAsync (/@expo/xdl@57.9.35/src/detach/AndroidShellApp.js:1412:11)
1147      at Object.createAndroidShellAppAsync (/@expo/xdl@57.9.35/src/detach/AndroidShellApp.js:370:5)
1148      at runShellAppBuilder (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:91:5)
1149      at buildAndroid (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:23:26)
1150      at /usr/local/lib/node_modules/turtle-cli/src/bin/utils/builder.ts:87:7
1151      at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:23:12)
1152  platform: "android"

Environment

 Expo CLI 3.27.7 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.18.3 - /usr/local/bin/node
      Yarn: 1.22.4 - ~/.yarn/bin/yarn
      npm: 6.14.7 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    IDEs:
      Xcode: 11.6/11E708 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^39.0.0 => 39.0.2
      react-native: https://github.com/expo/react-native/archive/sdk-39.0.0.tar.gz => 0.63.2
    npmGlobalPackages:
      expo-cli: 3.27.7
    Expo Workflow: managed
peter-jozsa commented 3 years ago

Manually downloading it from https://dl.google.com/android/repository/android-ndk-r21-darwin-x86_64.zip and extracting it to ~/.turtle/androidDependencies/sdk/ndk/21.0.6113669 solved the problem.

dsokal commented 3 years ago

This should be fixed in the latest turtle-cli - 0.18.1. Sorry for the inconvenience.

@peter-jozsa Let me know if this is still an issue for you.

peter-jozsa commented 3 years ago

I upgraded to 0.18.1 and removed my manually installed 21.0.6113669 NDK and started a build. It seems to work now, thanks for your quick assistance.

borgogelli commented 3 years ago

Same error for me. I have upgraded to 0.18.1 but on the path ".turtle/androidDependencies/sdk/ndk" I can see only the dir "17.2.4988734"

peter-jozsa commented 3 years ago

The fix @dsokal implemented forces gradle to use the installed 17.2.4988734 version of NDK. Your problem still exists after upgrading to 0.18.1 of tutle-cli?

borgogelli commented 3 years ago

The fix @dsokal implemented forces gradle to use the installed 17.2.4988734 version of NDK. Your problem still exists after upgrading to 0.18.1 of tutle-cli?

yes

borgogelli commented 3 years ago
Expo CLI 3.27.12 environment info:
    System:
      OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
      Shell: 5.0.17 - /bin/bash
    Binaries:
      Node: 10.19.0 - /usr/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm
    npmPackages:
      expo: ^39.0.3 => 39.0.3
      react: 16.13.1 => 16.13.1
      react-dom: 16.13.1 => 16.13.1
      react-native: https://github.com/expo/react-native/archive/sdk-39.0.0.tar.gz => 0.63.2
    npmGlobalPackages:
      expo-cli: 3.27.12
    Expo Workflow: managed
borgogelli commented 3 years ago

I have resolved ! I have forgotten to update an env variable on my ci script: turtle setup:android --sdk-version ${EXPO_SDK_VERSION} Now with EXPO_SDK_VERSION=39.0.0 all works fine. Thank you.