You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove requirement to have `<android-sdk>/tools` and `<android-sdk>/platform-tools` directories to your PATH - use them based on ANDROID_HOME variable.
* Based on the above point - replace all calls to `android` directly with correct path to the `android` executable.
* Remove requirement for JAVA added in your PATH - validate it by using JAVA_HOME.
* Improve error messages when ANDROID_HOME is not set - for example warning about missing compile SDK will inform you in case ANDROID_HOME is not set.
* Improve ANDROID_HOME checks - validate that directories like "extras", "tools", "platform-tools" exist (at least on of them).
* Validate JAVA version in doctor command.
* Sometimes `build-tools` directories are not called with version(`22.0.1`), but have the name: `build-tools-22.0.1` - make sure we will be able to use such dirs
* Skip cocoapods warnings on Linux and Windows (for `tns doctor` command).
this.$errors.failWithoutHelp(`Unable to find "${this.androidExecutableName}" executable file. Make sure you have set ANDROID_HOME environment variable correctly.`);
48
+
}
49
+
}else{
50
+
this.$errors.failWithoutHelp("ANDROID_HOME environment variable is not set correctly.");
this.printMessage("The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.",
49
-
"To be able to perform Android build-related operations, set the ANDROID_HOME variable to point to the root of your Android SDK installation directory.");
this.printMessage(`Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK ${AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET} or later.`,
54
98
"Run `$ android` to manage your Android SDK versions.");
@@ -65,14 +109,21 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
65
109
message=`You have to install version ${versionRangeMatches[1]}.`;
66
110
}
67
111
68
-
this.printMessage("You need to have the Android SDK Build-tools installed on your system. "+message,
69
-
'Run "android" from your command-line to install required Android Build Tools.');
112
+
letinvalidBuildToolsAdditionalMsg='Run `android` from your command-line to install required `Android Build Tools`.';
113
+
if(!isAndroidHomeValid){
114
+
invalidBuildToolsAdditionalMsg+=' In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly.';
115
+
}
116
+
117
+
this.printMessage("You need to have the Android SDK Build-tools installed on your system. "+message,invalidBuildToolsAdditionalMsg);
70
118
detectedErrors=true;
71
119
}
72
120
73
121
if(!toolsInfoData.supportRepositoryVersion){
74
-
this.printMessage(`You need to have Android SDK ${AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET} or later and the latest Android Support Repository installed on your system.`,
75
-
"Run `$ android` to manage the Android Support Repository.");
122
+
letinvalidSupportLibAdditionalMsg='Run `$ android` to manage the Android Support Repository.';
123
+
if(!isAndroidHomeValid){
124
+
invalidSupportLibAdditionalMsg+=' In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly.';
125
+
}
126
+
this.printMessage(`You need to have Android SDK ${AndroidToolsInfo.MIN_REQUIRED_COMPILE_TARGET} or later and the latest Android Support Repository installed on your system.`,invalidSupportLibAdditionalMsg);
76
127
detectedErrors=true;
77
128
}
78
129
@@ -92,7 +143,31 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
letadditionalMessage="You will not be able to build your projects for Android."+EOL
157
+
+"To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as"+EOL+
158
+
" described in https://github.com/NativeScript/nativescript-cli#system-requirements.";
this.printMessage(`Javac version ${installedJavaVersion} is not supported. You have to install at least ${AndroidToolsInfo.MIN_JAVA_VERSION}.`,additionalMessage);
164
+
}
165
+
}else{
166
+
hasProblemWithJavaVersion=true;
167
+
this.printMessage("Error executing command 'javac'. Make sure you have java installed and set JAVA_HOME environment variable.",additionalMessage);
168
+
}
169
+
170
+
returnhasProblemWithJavaVersion;
96
171
}).future<boolean>()();
97
172
}
98
173
@@ -113,7 +188,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
113
188
}
114
189
115
190
if(additionalMsg){
116
-
this.$logger.info(additionalMsg);
191
+
this.$logger.printMarkdown(additionalMsg);
117
192
}
118
193
}
119
194
@@ -157,10 +232,24 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
this.printMessage("The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.",
341
+
"To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory.");
this.printMessage("The ANDROID_HOME environment variable points to incorrect directory. You will not be able to perform any build-related operations for Android.",
345
+
"To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory, "+
346
+
"where you will find `tools` and `platform-tools` directories.");
this.$errors.failWithoutHelp(`Your current java version is ${javaVersion}. NativeScript CLI needs at least ${AndroidProjectService.MIN_JAVA_VERSION} version to work correctly. Ensure that you have at least ${AndroidProjectService.MIN_JAVA_VERSION} java version installed and try again.`);
432
-
}
433
-
}catch(error){
434
-
this.$errors.failWithoutHelp("Error executing command 'java'. Make sure you have java installed and added to your PATH.");
435
-
}
436
-
}).future<void>()();
437
-
}
438
-
439
426
privatecheckAnt(): IFuture<void>{
440
427
return(()=>{
441
428
try{
@@ -446,20 +433,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
446
433
}).future<void>()();
447
434
}
448
435
449
-
privatecheckAndroid(): IFuture<void>{
450
-
return(()=>{
451
-
try{
452
-
this.$childProcess.exec('android list targets').wait();
453
-
}catch(error){
454
-
if(error.message.match(/command\snot\sfound/)){
455
-
this.$errors.fail("The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.");
456
-
}else{
457
-
this.$errors.fail("An error occurred while listing Android targets");
0 commit comments