diff --git a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt index b72f6701f9ea03..24bb8cf24fefda 100644 --- a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt +++ b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt @@ -112,9 +112,14 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings internal fun getLibrariesToAutolink(buildFile: File): Map { val model = JsonUtils.fromAutolinkingConfigJson(buildFile) - return model?.dependencies?.values?.associate { deps -> - ":${deps.nameCleansed}" to File(deps.platforms?.android?.sourceDir) - } ?: emptyMap() + return model?.dependencies?.values?.mapNotNull { deps -> + val sourceDir = deps.platforms?.android?.sourceDir + if (sourceDir != null) { + ":${deps.nameCleansed}" to File(sourceDir) + } else { + null + } + }?.toMap() ?: emptyMap() } internal fun computeSha256(lockFile: File) =