@@ -146,10 +146,14 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
146
146
147
147
private getBuildToolsVersion ( ) : IFuture < string > {
148
148
return ( ( ) : string => {
149
- let pathToBuildTools = path . join ( this . androidHome , "build-tools" ) ;
150
- let buildToolsRange = this . getBuildToolsRange ( ) ;
149
+ let buildToolsVersion : string ;
150
+ if ( this . androidHome ) {
151
+ let pathToBuildTools = path . join ( this . androidHome , "build-tools" ) ;
152
+ let buildToolsRange = this . getBuildToolsRange ( ) ;
153
+ buildToolsVersion = this . getMatchingDir ( pathToBuildTools , buildToolsRange ) . wait ( ) ;
154
+ }
151
155
152
- return this . getMatchingDir ( pathToBuildTools , buildToolsRange ) . wait ( ) ;
156
+ return buildToolsVersion ;
153
157
} ) . future < string > ( ) ( ) ;
154
158
}
155
159
@@ -167,9 +171,13 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
167
171
168
172
private getAndroidSupportLibVersion ( ) : IFuture < string > {
169
173
return ( ( ) : string => {
170
- let pathToAppCompat = path . join ( this . androidHome , "extras" , "android" , "m2repository" , "com" , "android" , "support" , "appcompat-v7" ) ;
174
+ let selectedAppCompatVersion : string ;
171
175
let requiredAppCompatRange = this . getAppCompatRange ( ) . wait ( ) ;
172
- let selectedAppCompatVersion = requiredAppCompatRange ? this . getMatchingDir ( pathToAppCompat , requiredAppCompatRange ) . wait ( ) : undefined ;
176
+ if ( this . androidHome && requiredAppCompatRange ) {
177
+ let pathToAppCompat = path . join ( this . androidHome , "extras" , "android" , "m2repository" , "com" , "android" , "support" , "appcompat-v7" ) ;
178
+ selectedAppCompatVersion = this . getMatchingDir ( pathToAppCompat , requiredAppCompatRange ) . wait ( ) ;
179
+ }
180
+
173
181
this . $logger . trace ( `Selected AppCompat version is: ${ selectedAppCompatVersion } ` ) ;
174
182
return selectedAppCompatVersion ;
175
183
} ) . future < string > ( ) ( ) ;
0 commit comments