expo / turtle

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

Building android test .apk for Detox tests #296

Open alexfaber2011 opened 3 years ago

alexfaber2011 commented 3 years ago

Question Checklist

Question Subject

Is it possible to build a test Android .apk from turtle build:android for use in a Detox configuration?

Question Description

First off, y'all are amazing. Expo and Turtle-CLI are fantastic, thank you for the great work you're doing. I'm part of a happy team that's an Expo customer.

I'm attempting to test an Android application that I'm building with turtle in Detox. It requires both an app .apk and a test .apk. I've succesfully gotten turtle to spit out a nicely working app .apk, but I'm not sure how to get it to build a test .apk. The Detox documentation suggests running gradle with the following options: ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release. I tried applying those options with...

turtle build:android \
       --build-dir $BUILD_DIR \
       --username $EXPO_USERNAME \
       --password $EXPO_PASSWORD \
       --config app.config.ts \
       --release-channel $RELEASE_CHANNEL \
       --gradle-args "assembleRelease assembleAndroidTest -DtestBuildType=release" \
       --type apk \
       --mode release

Doing so yields...

err: Error: ./gradlew exited with non-zero code: 1
      at ChildProcess.completionListener (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
      at Object.onceWrapper (events.js:422:26)
      at ChildProcess.emit (events.js:315:20)
      at ChildProcess.EventEmitter.emit (domain.js:467:12)
      at maybeClose (internal/child_process.js:1048:16)
      at Socket.<anonymous> (internal/child_process.js:439:11)
      at Socket.emit (events.js:315:20)
      at Socket.EventEmitter.emit (domain.js:467:12)
      at Pipe.<anonymous> (net.js:673:12)
      ...
      at spawnAsync (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
      at spawnAsyncThrowError (/@expo/xdl@58.0.20/src/detach/ExponentTools.ts:111:19)
      at buildShellAppAsync (/@expo/xdl@58.0.20/src/detach/AndroidShellApp.js:1471:11)
      at Object.createAndroidShellAppAsync (/@expo/xdl@58.0.20/src/detach/AndroidShellApp.js:380:5)
      at runShellAppBuilder (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:91:5)
      at buildAndroid (/usr/local/lib/node_modules/turtle-cli/src/builders/android.ts:23:26)
      at /usr/local/lib/node_modules/turtle-cli/src/bin/utils/builder.ts:87:7
      at Command.<anonymous> (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:23:12)
  platform: "android"

Any idea what might be happening here? Perhaps Turtle isn't designed for this kind of thing?

seba9999 commented 3 years ago

Bump this up because I'm facing the same problem ... Any chance to get this working wirth turtle-cli ?