11apply plugin : ' com.android.library'
2- apply plugin : ' com.facebook.react'
32apply plugin : ' maven-publish'
43
54android {
@@ -53,19 +52,19 @@ dependencies {
5352
5453 // Only add these packages if we are NOT doing a LIBRE_BUILD
5554 if (! rootProject. ext. libreBuild) {
56- implementation project(' :amplitude-analytics- react-native' )
57- implementation project(' :giphy- react-native-sdk ' )
58- implementation(project(' :react-native-google-signin-google-signin ' )) {
55+ implementation project(' :react-native-amplitude ' )
56+ implementation project(' :react-native-giphy ' )
57+ implementation(project(' :react-native-google-signin' )) {
5958 exclude group : ' com.google.android.gms'
6059 exclude group : ' androidx'
6160 }
6261 }
6362
64- implementation project(' :react-native-async-storage-async-storage ' )
63+ implementation project(' :react-native-async-storage' )
6564 implementation project(' :react-native-background-timer' )
6665 implementation project(' :react-native-calendar-events' )
67- implementation project(' :react-native-clipboard-clipboard ' )
68- implementation project(' :react-native-community-netinfo ' )
66+ implementation project(' :react-native-community_clipboard ' )
67+ implementation project(' :react-native-community_netinfo ' )
6968 implementation project(' :react-native-default-preference' )
7069 implementation(project(' :react-native-device-info' )) {
7170 exclude group : ' com.google.firebase'
@@ -74,13 +73,13 @@ dependencies {
7473 }
7574 implementation project(' :react-native-gesture-handler' )
7675 implementation project(' :react-native-get-random-values' )
77- implementation project(' :sayem314- react-native-keep-awake' )
76+ implementation project(' :react-native-keep-awake' )
7877 implementation project(' :react-native-orientation-locker' )
7978 implementation project(' :react-native-pager-view' )
8079 implementation project(' :react-native-performance' )
8180 implementation project(' :react-native-safe-area-context' )
8281 implementation project(' :react-native-screens' )
83- implementation project(' :react-native-community- slider' )
82+ implementation project(' :react-native-slider' )
8483 implementation project(' :react-native-sound' )
8584 implementation project(' :react-native-splash-view' )
8685 implementation project(' :react-native-svg' )
@@ -136,8 +135,17 @@ android.libraryVariants.all { def variant ->
136135 // Set up dev mode
137136 def devEnabled = ! targetName. toLowerCase(). contains(" release" )
138137
138+ // Run the bundler
139+ // Use full path to node to avoid PATH issues in Gradle
140+ def nodePath = System . getenv(' NVM_BIN' ) ? " ${ System.getenv('NVM_BIN')} /node" : " node"
141+
142+ // Debug: Print the node path and environment
143+ println " Using node path: ${ nodePath} "
144+ println " NVM_BIN: ${ System.getenv('NVM_BIN')} "
145+ println " Working directory: ${ reactRoot} "
146+
139147 commandLine(
140- " node " ,
148+ nodePath ,
141149 " node_modules/react-native/scripts/bundle.js" ,
142150 " --platform" , " android" ,
143151 " --dev" , " ${ devEnabled} " ,
@@ -150,22 +158,70 @@ android.libraryVariants.all { def variant ->
150158 enabled ! devEnabled
151159 }
152160
153- // Ensure proper task ordering for Gradle 8.14+ strict dependency validation
154- currentBundleTask. configure {
155- mustRunAfter {
156- def config = project. configurations. findByName(" ${ targetPath} CompileClasspath" )
157-
158- // Fallback to an empty list(mustRunAfter expects a list, not "null" which is the og fallback),
159- // means no config, means no constraints
160- (config?. allDependencies ?: [])
161- .findAll { it. hasProperty(' dependencyProject' ) }
162- .collectMany { dependency ->
163- project. project(dependency. dependencyProject. path)
164- .tasks. matching { it. name. contains(targetName) }
161+ // GRADLE REQUIREMENTS (Gradle 8.7+ / AGP 8.5.0+):
162+
163+ // This task requires explicit dependencies on resource tasks from all React Native modules
164+ // due to Gradle's strict validation of task dependencies.
165+
166+ // Without these dependencies,
167+ // builds will fail with errors like:
168+ // "Task ':sdk:bundleReleaseJsAndAssets' uses the output of task ':react-native-amplitude:packageReleaseResources'
169+ // without declaring a dependency on it."
170+
171+ // The automatic dependency resolution below ensures all required resource tasks are properly
172+ // declared as dependencies before this task executes.
173+
174+ if (variant. name. toLowerCase(). contains(" release" )) {
175+ rootProject. subprojects. each { subproject ->
176+ if (
177+ subproject. name. startsWith(" react-native-" ) ||
178+ subproject. name. startsWith(" @react-native-" ) ||
179+ subproject. name. startsWith(" @giphy/" )
180+ ) {
181+ [
182+ " packageReleaseResources" ,
183+ " generateReleaseResValues" ,
184+ " generateReleaseResources" ,
185+ " generateReleaseBuildConfig" ,
186+ " processReleaseManifest" ,
187+ " writeReleaseAarMetadata" ,
188+ " generateReleaseRFile" ,
189+ " compileReleaseLibraryResources" ,
190+ " compileReleaseJavaWithJavac" ,
191+ " javaPreCompileRelease" ,
192+ " bundleLibCompileToJarRelease" ,
193+ " exportReleaseConsumerProguardFiles" ,
194+ " mergeReleaseGeneratedProguardFiles" ,
195+ " mergeReleaseJniLibFolders" ,
196+ " mergeReleaseShaders" ,
197+ " packageReleaseAssets" ,
198+ " processReleaseJavaRes" ,
199+ " prepareReleaseArtProfile" ,
200+ " copyReleaseJniLibsProjectOnly" ,
201+ " extractDeepLinksRelease" ,
202+ " createFullJarRelease" ,
203+ " generateReleaseLintModel" ,
204+ " writeReleaseLintModelMetadata" ,
205+ " generateReleaseLintVitalModel" ,
206+ " lintVitalAnalyzeRelease" ,
207+ " lintReportRelease" ,
208+ " lintAnalyzeRelease" ,
209+ " lintReportDebug" ,
210+ " lintAnalyzeDebug"
211+ ]. each { taskName ->
212+ if (subproject. tasks. findByName(taskName)) {
213+ currentBundleTask. dependsOn(subproject. tasks. named(taskName))
214+ }
165215 }
216+
217+ // Also depend on the main build task to ensure all sub-tasks are completed
218+ if (subproject. tasks. findByName(" build" )) {
219+ currentBundleTask. dependsOn(subproject. tasks. named(" build" ))
220+ }
221+ }
166222 }
167223 }
168-
224+
169225 currentBundleTask. ext. generatedResFolders = files(resourcesDir). builtBy(currentBundleTask)
170226 currentBundleTask. ext. generatedAssetsFolders = files(jsBundleDir). builtBy(currentBundleTask)
171227 variant. registerGeneratedResFolders(currentBundleTask. generatedResFolders)
@@ -235,7 +291,7 @@ publishing {
235291 def groupId = it. moduleGroup
236292 def artifactId = it. moduleName
237293
238- if (artifactId. contains (' react-native' )) {
294+ if (artifactId. startsWith (' react-native- ' )) {
239295 groupId = rootProject. ext. moduleGroupId
240296 }
241297
0 commit comments