[TIMOB-24681] Android: AVD detection fails if matching SDK is not installed
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-05-16T17:13:27.000+0000 |
Affected Version/s | Release 6.1.0, Release 6.0.4 |
Fix Version/s | Release 6.1.0 |
Components | Android |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Chris Barber |
Created | 2017-05-11T22:23:37.000+0000 |
Updated | 2017-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)
[~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.
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.
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.
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
andplatforms
directories so that Titanium can't find them, then runti info -t android
.LGTM. [~jvennemann] to confirm.
Looks good! Did a quick check, no crashes anymore!
FR passed for backport.
Backport PR merged.
Master PR merged.
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