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
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
104
"Run `$ android` to manage your Android SDK versions.");
@@ -65,14 +115,21 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
65
115
message=`You have to install version ${versionRangeMatches[1]}.`;
66
116
}
67
117
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.');
118
+
letinvalidBuildToolsAdditionalMsg='Run `android` from your command-line to install required `Android Build Tools`.';
119
+
if(!isAndroidHomeValid){
120
+
invalidBuildToolsAdditionalMsg+=' In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly.';
121
+
}
122
+
123
+
this.printMessage("You need to have the Android SDK Build-tools installed on your system. "+message,invalidBuildToolsAdditionalMsg);
70
124
detectedErrors=true;
71
125
}
72
126
73
127
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.");
128
+
letinvalidSupportLibAdditionalMsg='Run `$ android` to manage the Android Support Repository.';
129
+
if(!isAndroidHomeValid){
130
+
invalidSupportLibAdditionalMsg+=' In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly.';
131
+
}
132
+
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
133
detectedErrors=true;
77
134
}
78
135
@@ -92,7 +149,31 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
letadditionalMessage="You will not be able to build your projects for Android."+EOL
163
+
+"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+
164
+
" 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);
170
+
}
171
+
}else{
172
+
hasProblemWithJavaVersion=true;
173
+
this.printMessage("Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.",additionalMessage);
174
+
}
175
+
176
+
returnhasProblemWithJavaVersion;
96
177
}).future<boolean>()();
97
178
}
98
179
@@ -113,7 +194,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
113
194
}
114
195
115
196
if(additionalMsg){
116
-
this.$logger.info(additionalMsg);
197
+
this.$logger.printMarkdown(additionalMsg);
117
198
}
118
199
}
119
200
@@ -157,10 +238,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.",
349
+
"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.",
353
+
"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, "+
354
+
"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.`);
433
-
}
434
-
}catch(error){
435
-
this.$errors.failWithoutHelp("Error executing command 'java'. Make sure you have java installed and added to your PATH.");
436
-
}
437
-
}).future<void>()();
438
-
}
439
-
440
427
privatecheckAnt(): IFuture<void>{
441
428
return(()=>{
442
429
try{
@@ -447,20 +434,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
447
434
}).future<void>()();
448
435
}
449
436
450
-
privatecheckAndroid(): IFuture<void>{
451
-
return(()=>{
452
-
try{
453
-
this.$childProcess.exec('android list targets').wait();
454
-
}catch(error){
455
-
if(error.message.match(/command\snot\sfound/)){
456
-
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.");
457
-
}else{
458
-
this.$errors.fail("An error occurred while listing Android targets");
0 commit comments