Skip to content

Commit ea06dce

Browse files
author
Stewart Miles
committed
Fixed null reference exception when Android SDK path not set.
If the Android SDK path is not set the Android Resolver now reports an error rather and fails resolution rather than throwing a null reference exception. Bug: 67596956 Change-Id: I75517a7d216d9ef74f8c184e89de780818917448
1 parent fbe00d8 commit ea06dce

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 1.2.62 - TBD
2+
## Bug Fixes
3+
* Fixed Android Resolver throwing NullReferenceException when the Android SDK
4+
path isn't set.
5+
16
# Version 1.2.61 - Jan 22, 2017
27
## Bug Fixes
38
* Fixed Android Resolver reporting non-existent conflicting dependencies when

source/PlayServicesResolver/src/ResolverVer1_1.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,19 @@ private void DoResolutionUnsafe(
845845
{
846846
// Cache the setting as it can only be queried from the main thread.
847847
var sdkPath = svcSupport.SDK;
848+
// If the Android SDK path isn't set or doesn't exist report an error.
849+
if (String.IsNullOrEmpty(sdkPath) || !Directory.Exists(sdkPath)) {
850+
PlayServicesResolver.Log(String.Format(
851+
"Android dependency resolution failed, your application will probably " +
852+
"not run.\n\n" +
853+
"Android SDK path must be set to a valid directory ({0})\n" +
854+
"This must be configured in the 'Preference > External Tools > Android SDK'\n" +
855+
"menu option.\n", String.IsNullOrEmpty(sdkPath) ? "{none}" : sdkPath),
856+
level: LogLevel.Error);
857+
resolutionComplete();
858+
return;
859+
}
860+
848861
System.Action resolve = () => {
849862
PlayServicesResolver.Log("Performing Android Dependency Resolution",
850863
LogLevel.Verbose);

0 commit comments

Comments
 (0)