Error building app locally using turtle-cli

Hi all,

I am using turtle-cli to build an app locally following the guide posted here: https://docs.expo.io/versions/latest/distribution/turtle-cli/

My environment is OSX 10.14.1 and I have met the prerequisites on the guide for the needed software.

The build command that I’m running is:

jamesmorad$ turtle build:android --public-url http://`ipconfig getifaddr en0`:8000/android-index.json --keystore-path /path/to/keyfil --keystore-alias my_alias

Where I have a webserver hosting the android-index.json file on the same machine.

The program exits with the following error message:

Jan 28 11:03:21 turtle[78788] INFO:  Starting build process
  buildPhase: "starting builder"
Jan 28 11:03:21 turtle[78788] INFO:  ImageUtils: setting image functions to alternative sharp implementations
  buildPhase: "icons setup"
Jan 28 11:03:21 turtle[78788] INFO:  Using manifest: {"name":"Testing app","slug":"testing","privacy":"public","sdkVersion":"32.0.0","platforms":["ios","android"],"version":"1.0.0","orientation":"portrait","icon":"./assets/images/icon.png","splash":{"image":"./assets/images/splash.png","resizeMode":"contain","backgroundColor":"#ffffff","imageUrl":"http://10.0.4.80:8000/assets/43ec0dcbe5a156bf9e650bb8c15e7af6"},"updates":{"fallbackToCacheTimeout":0},"ios":{"supportsTablet":true},"locales":{},"iconUrl":"http://10.0.4.80:8000/assets/fa6577fecc0a7838f15a254577639984","bundledAssets":["asset_3a2ba31570920eeb9b1d217cabe58315.ttf","asset_744ce60078c17d86006dd0edabcd59a7.ttf","asset_140c53a7643ea949007aa9a282153849.ttf","asset_6beba7e6834963f7f171d3bdd075c915.ttf","asset_b06871f281fee6b241d60582ae9369b9.ttf","asset_e20945d7c929279ef7a6f1db184a4470.ttf","asset_b2e0fc821c6886fb3940f85a3320003e.ttf","asset_d15c1216957060fac577af6151fb8cfe.ttf","asset_a37b0c01c0baf1888ca812cc0508f6e2.ttf","asset_73b8cff012825060b308d2162f31dbb2.ttf","asset_d2285965fe34b05465047401b8595dd0.ttf","asset_5cdf883b18a5651a29a4d1ef276d2457.ttf","asset_7d40544b395c5949f4646f5e150fe020.png","asset_cdd04e13d4ec83ff0cd13ec8dabdc341.png","asset_a132ecc4ba5c1517ff83c0fb321bc7fc.png","asset_0ea69b5077e7c4696db85dbcba75b0e1.png","asset_f5b790e2ac193b3d41015edb3551f9b8.png","asset_6165c9d7a2e729ba57b23dd93add5366.png","asset_45a8ce76165dcaec1c5e39be15478e53.png","asset_2d8deea13c41b52b04442d91fb31c2c5.png","asset_5c36108361d0a750fd25533356f80245.png","asset_af47141a24eb8e5751dfd034159479bd.png","asset_ad107d1ca027259ca50ce0f432293e6c.png","asset_a30cd76fa74ee5a0bab5aba37c101416.png","asset_49a79d66bdea2debf1832bf4d7aca127.ttf","asset_778ffc9fe8773a878e9c30a6304784de.png","asset_376d6a4c7f622917c39feb23671ef71d.png","asset_c79c3606a1cf168006ad3979763c7e0c.png","asset_02bc1fa7c0313217bde2d65ccbff40c9.png","asset_35ba0eaec5a4f5ed12ca16fabeae451d.png"],"assetUrlOverride":"./assets","publishedTime":"2019-01-26T01:27:02.285Z","commitTime":"2019-01-26T01:27:02.285Z","revisionId":"bnvj1k59j6","developer":{"tool":"exp"},"id":"@anonymous/testing","bundleUrl":"http://10.0.4.80:8000/bundles/android-62d5decda5ce4b4acd5fffff4fd703da.js","platform":"android"}
  buildPhase: "reading manifest"
Jan 28 11:03:21 turtle[78788] INFO:  ~/.turtle/workingdir/android/sdk32/tools-public ~/.turtle/workingdir/android/sdk32/android/app
  buildPhase: "confirming that dynamic macros exist"
  source: "stdout"
Jan 28 11:03:21 turtle[78788] INFO:  ~/.turtle/workingdir/android/sdk32/android/app
  buildPhase: "confirming that dynamic macros exist"
  source: "stdout"
Jan 28 11:03:24 turtle[78788] ERROR: TypeError: Cannot read property 'package' of undefined
    at /xdl@52.0.14-alpha.6+371be041/src/detach/AndroidShellApp.js:393:38
    at Generator.next (<anonymous>)
    at step (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:191)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:437
    at new Promise (<anonymous>)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:99
    at runShellAppModificationsAsync (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:398:18)
    at Object.<anonymous> (/xdl@52.0.14-alpha.6+371be041/src/detach/AndroidShellApp.js:351:9)
    at Generator.next (<anonymous>)
    at step (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:191)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:361
Jan 28 11:03:24 turtle[78788] ERROR: Failed to build standalone app: Cannot read property 'package' of undefined
Jan 28 11:03:24 turtle[78788] ERROR: TypeError: Cannot read property 'package' of undefined
    at /xdl@52.0.14-alpha.6+371be041/src/detach/AndroidShellApp.js:393:38
    at Generator.next (<anonymous>)
    at step (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:191)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:437
    at new Promise (<anonymous>)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:99
    at runShellAppModificationsAsync (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:398:18)
    at Object.<anonymous> (/xdl@52.0.14-alpha.6+371be041/src/detach/AndroidShellApp.js:351:9)
    at Generator.next (<anonymous>)
    at step (/Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:191)
    at /Users/jamesmorad/.config/yarn/global/node_modules/xdl/build/detach/AndroidShellApp.js:606:361

Any thoughts on what I may be doing wrong here would be very helpful. Thanks!

EDIT:

Digging around a bit, it looks like the first error output points to this line in AndroidShellApp.js:

 // Google sign in
    yield regexFileAsync(/"current_key": "(.*?)"/, `"current_key": "${googleAndroidApiKey}"`, _path.default.join(shellPath, 'app', 'google-services.json'));
    yield regexFileAsync(/"certificate_hash": "(.*?)"/, `"certificate_hash": "${certificateHash}"`, _path.default.join(shellPath, 'app', 'google-services.json'));

Which looks like the app is actually checking my key against something externally. If I generated my key with the Java keytool, do I need to register the key with an Android developer account before I can build an APK?

I sorted out the issue by going through AndroidShellApp and just doing some print statement debugging. It turned out that manifest.android.package was not initially set in my dists/android-index.json because it did not follow the correct naming format. When I updated the package name in app.json, I did not re-expo export to dists and the error was being thrown because manifest.android.package was a member attribute that didn’t exist for that variable. Cheers, and hopefully this helps anyone else down the road.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.