Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24681] Android: AVD detection fails if matching SDK is not installed

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-05-16T17:13:27.000+0000
Affected Version/sRelease 6.1.0, Release 6.0.4
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsn/a
ReporterJan Vennemann
AssigneeChris Barber
Created2017-05-11T22:23:37.000+0000
Updated2017-05-16T18:43:51.000+0000

Description

*Steps to reproduce the behavior* 1. Create an AVD in Android Studio via _Tools > Android > AVD Manager_ without the matching SDK being installed, e.g. AVD with Android 5.1 but no SDK 22 installed. This will download the required Google APIs System Image but not the SDK. 2. Try to run an app on that emulator with appc run -p android -C <emulator-id> -l trace *Actual behavior* The build crashes with the following error:
2017-05-11T14:00:12.722Z | ERROR  | Cannot read property 'name' of undefined
2017-05-11T14:00:12.722Z | TRACE  | TypeError: Cannot read property 'name' of undefined
    at /Users/jvennemann/Library/Application Support/Titanium/mobilesdk/osx/6.1.0.v20170510131349/node_modules/node-titanium-sdk/lib/android.js:671:23
*Expected behavior* The build succeeds and the app launches on the specified AVD. *Additional notes* This also breaks appc info with the unhelpful error:
2017-05-11T22:19:03.961Z | ERROR  | Error: titanium exited with exit code 1. re-run with -l trace to get detailed output
    at ChildProcess.<anonymous> (/Users/jvennemann/.appcelerator/install/6.2.0/package/lib/commands/info.js:45:23)

Comments

  1. Hans Knöchel 2017-05-12

    [~cbarber] It's the one we talked about last week. May include a match-validation of AVD -> SDK-Level, so it breaks earlier and informs the user about the issue.
  2. Jan Vennemann 2017-05-12

    Should it really break? I would say building the app with SDK 23 and then running it on an AVD with API Level 22 to test how it works should be a valid use case. Why would i want to install the SDK if i only need the AVD to see how my app works on that specific API level.
  3. Ketan Majmudar 2017-05-12

    I created an AVD with current tooling level (25) then it would allow me to build. the AVD that wasn't linked I deleted, but then it kept crashing (as I use genymotion) until I created an android AVD against the installed SDK (25 as mentioned). i'm back up and running now.
  4. Chris Barber 2017-05-12

    node-titanium-sdk PR: https://github.com/appcelerator/node-titanium-sdk/pull/3 node-titanium-sdk@0.2.3 published TiSDK master PR: https://github.com/appcelerator/titanium_mobile/pull/9057 TiSDK 6_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/9058 To test, open your Android SDK folder, then rename the addons and platforms directories so that Titanium can't find them, then run ti info -t android.
  5. Hans Knöchel 2017-05-12

    LGTM. [~jvennemann] to confirm.
  6. Jan Vennemann 2017-05-13

    Looks good! Did a quick check, no crashes anymore!
  7. Lokesh Choudhary 2017-05-16

    FR passed for backport.
  8. Lokesh Choudhary 2017-05-16

    Backport PR merged.
  9. Lokesh Choudhary 2017-05-16

    Master PR merged.
  10. Lokesh Choudhary 2017-05-16

    Verified the fix in 6.1.0.v20170516103606. AVD detection does not fail & avd launches successfully if matching SDK is not installed. Closing. Studio Ver: 4.9.0.201705110256 SDK Ver: 6.1.0.v20170516103606 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.2 Appc NPM: 4.2.9 Appc CLI: 6.2.1 Ti CLI Ver: 5.0.13 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101

JSON Source