Print error message if system server jar is missing in prebuilt apex

If a system server jar declared in `PRODUCT_APEX_SYSTEM_SERVER_JAR` is
missing in the prebuilt apex file, a nil pointer exception is raised
during soong analysis. To improve debugagibity, replace this with an
error message that mentions the missing library name.

Test: presubmits
Bug: 388778489
Change-Id: Id01f8dd23b84e7735b7e45ebcd81fb1121f44ca5
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 44ba80a..efca913 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -346,7 +346,11 @@
 	d.installPath = android.PathForModuleInPartitionInstall(ctx, "", strings.TrimPrefix(dexpreopt.GetSystemServerDexLocation(ctx, dc, libraryName), "/"))
 	// generate the rules for creating the .odex and .vdex files for this system server jar
 	dexJarFile := di.PrebuiltExportPath(ApexRootRelativePathToJavaLib(libraryName))
-
+	if dexJarFile == nil {
+		ctx.ModuleErrorf(
+			`Could not find library %s in prebuilt apex %s.
+Please make sure that the value of PRODUCT_APEX_(SYSTEM_SERVER|STANDALONE_SYSTEM_SERVER)_JARS is correct`, libraryName, ctx.ModuleName())
+	}
 	d.inputProfilePathOnHost = nil // reset: TODO(spandandas): Make dexpreopter stateless
 	if android.InList(libraryName, di.GetDexpreoptProfileGuidedExportedModuleNames()) {
 		// Set the profile path to guide optimization