Could not determine the dependencies of task ':app:processDebugResources'.
🚀 [UPDATE] Solution 🚀
📂 android/build.gradle
allprojects {
repositories {
+ mavenLocal()
+ mavenCentral()
// Required for react-native-background-geolocation
maven { url("${project(':react-native-background-geolocation').projectDir}/libs") }
maven { url 'https://developer.huawei.com/repo/' }
// Required for react-native-background-fetch
maven { url("${project(':react-native-background-fetch').projectDir}/libs") }
}
}
Your Environment
- Plugin version: 4.1.10
- Platform: Android
- OS version: 12
- Device manufacturer / model: Pixel 5
- React Native version (
react-native -v):0.72.3 - Plugin config
Expected Behavior
After installation app should work
Actual Behavior
After installation throw an error
Steps to Reproduce
- add maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
- clear cache clean and rebuild
Context
I tried to implement the sample code
Debug logs
Could not determine the dependencies of task ':app:processDebugResources'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not find any matches for com.transistorsoft:tsbackgroundfetch:+ as no versions of com.transistorsoft:tsbackgroundfetch are available. Searched in the following locations: - https://oss.sonatype.org/content/repositories/snapshots/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://repo.maven.apache.org/maven2/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - file:/Users/khalif/Documents/WakeupOnDestination/node_modules/jsc-android/dist/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://dl.google.com/dl/android/maven2/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://www.jitpack.io/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - file:/Users/khalif/Documents/WakeupOnDestination/node_modules/@notifee/react-native/android/libs/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml Required by: project :app > project :react-native-background-fetch
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I had it working on an older version of RN (0.70.6), so I would assume I did the setup instructions correctly, but recently upgraded to 0.72.4. I even upgraded the background-geolocation and background-fetch packages to their latest versions.
But after the RN upgrade, I get hit with a similar sort of error. My console output says the following: `Could not determine the dependencies of task ':app:processDebugResources'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not resolve com.transistorsoft:tsbackgroundfetch:+. Required by: project :app > project :react-native-background-fetch > Failed to list versions for com.transistorsoft:tsbackgroundfetch. > Unable to load Maven meta-data from https://www.jitpack.io/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml. > Could not GET 'https://www.jitpack.io/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. > Read timed out`
Is there something I might still be doing wrong? Or is it due to the latest RN version that breaks this?
Post your android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
appCompatVersion = "1.4.2"
googlePlayServicesLocationVersion = "20.0.0"
RNMapboxMapsImpl = "mapbox"
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("com.google.gms:google-services:4.3.14")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.2")
}
}
allprojects {
repositories {
maven {
// Required for react-native-background-geolocation
url("${project(':react-native-background-geolocation').projectDir}/libs")
}
maven {
// Required for react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
//
}
}
}
}
In the /example app in this repo, the allprojects/repositories section contains both mavenLocal() and mavenCentral()
https://github.com/transistorsoft/react-native-background-fetch/blob/35408089abbc06e430be821a4e02faaa6d2f520a/example/android/build.gradle#L31
That did resolve the issue. Just as a headsup: the RN upgrade explicitly removes the allprojects and by extension all the repositories in there, so even though the docs are correct that you have to add it back in (see here), it skips the mavenCentral and mavenLocal having to also be added back in
I just did a fresh new $ npx react-native init foo, added the plugin according to the current Setup Instructions. I did not have to add anything extra (ie: mavenLocal(), mavenCentral()) to allprojects/repositories.
{
"name": "foo2",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.11",
"@tsconfig/react-native": "^3.0.0",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.8",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"engines": {
"node": ">=16"
}
}
📂 android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
appCompatVersion = "1.4.2" // Or higher. Required for new AndroidX compatibility.
googlePlayServicesLocationVersion = "21.0.1" // Or higher.
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
allprojects {
repositories {
// Required for react-native-background-geolocation
maven { url("${project(':react-native-background-geolocation-android').projectDir}/libs") }
maven { url 'https://developer.huawei.com/repo/' }
// Required for react-native-background-fetch
maven { url("${project(':react-native-background-fetch').projectDir}/libs") }
}
}
With a simple implementation of BackgroundGeolocation, the plugin launches, fires events and enters the stationary-state.
08-18 10:25:39.910 16794 16951 I TSLocationManager: [c.t.l.adapter.TSConfig print]
08-18 10:25:39.910 16794 16951 I TSLocationManager: ╔═════════════════════════════════════════════
08-18 10:25:39.910 16794 16951 I TSLocationManager: ║ TSLocationManager version: 3.4.2 (422)
08-18 10:25:39.910 16794 16951 I TSLocationManager: ╠═════════════════════════════════════════════
08-18 10:25:39.910 16794 16951 I TSLocationManager: ╟─ Google Pixel 6 @ 14 (react-native)
08-18 10:25:39.910 16794 16951 I TSLocationManager: {
.
.
.
08-18 10:25:39.910 16794 16951 I TSLocationManager: }
.
.
.
08-18 10:25:46.347 16794 16794 D TSLocationManager: [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion]
08-18 10:25:46.347 16794 16794 D TSLocationManager: 🎾 Start monitoring stationary region (radius: 150.0m 45.5188929,-73.6005087 hAcc=26.4)
08-18 10:25:46.350 16794 16951 I TSLocationManager: [a.b persist]
08-18 10:25:46.350 16794 16951 I TSLocationManager: ✅ INSERT: 6ea5bd92-9d5b-4c8c-912b-8f10502d7483
08-18 10:25:46.360 1601 3727 I ActivityManager: Background started FGS: Allowed [callingPackage: com.foo2; callingUid: 10344; uidState: TPSL; uidBFSL: n/a; intent: Intent { act=motionchange cmp=com.foo2/com.transistorsoft.locationmanager.service.TrackingService }; code:ACTIVITY_STARTER; tempAllowListReason:<null,reasonCode:LOCATION_PROVIDER,duration:20000,callingUid:10149>; targetSdkVersion:33; callerTargetSdkVersion:33; startForegroundCount:0; bindFromPackage:null: isBindService:false]
08-18 10:25:46.377 16794 16794 D TSLocationManager: [c.t.l.service.AbstractService start]
08-18 10:25:46.377 16794 16794 D TSLocationManager: 🎾 TrackingService [eventCount: 1]
08-18 10:25:46.378 16794 16794 I TSLocationManager: [c.t.l.service.TrackingService handleMotionChangeResult]
08-18 10:25:46.378 16794 16794 I TSLocationManager: ╔═════════════════════════════════════════════
08-18 10:25:46.378 16794 16794 I TSLocationManager: ║ TrackingService motionchange: false
08-18 10:25:46.378 16794 16794 I TSLocationManager: ╠═════════════════════════════════════════════
However, I did initially have a runtime ClassCastException (from background-geolocation) related to that plugin importing the latest [email protected] (the plugin's Logger lib) because of this, where RN's com.facebook.flipper requires the older version (2.0.1). I will downgrade the plugin's default logback-android to match what flipper requires.
08-18 10:01:50.888 31886 32024 E AndroidRuntime: java.lang.ClassCastException: org.slf4j.helpers.SubstituteLogger cannot be cast to ch.qos.logback.classic.Logger
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at com.transistorsoft.locationmanager.logger.TSLog.getRootLogger(Unknown Source:6)
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at com.transistorsoft.locationmanager.logger.TSLog.access$000(Unknown Source:0)
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at com.transistorsoft.locationmanager.logger.TSLog$a.run(Unknown Source:0)
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
08-18 10:01:50.888 31886 32024 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
Could you please find out exactly which added repository fixes your issue?
Does just mavenLocal() fix it or does it require both mavenLocal() AND mavenCentral()?
Yes I will. I do not have the time right now, but I will check for you on monday :)
Today I upgraded the SampleApp from RN 0.68.5 -> 0.72.4.
It does not require any extra repositories in allprojects/repositories
allprojects {
repositories {
// It's been reported that some people might require mavenLocal() repo here.
// I leave it disabled for now.
//mavenLocal()
// Required for react-native-background-geolocation
maven { url("${project(':react-native-background-geolocation').projectDir}/libs") }
maven { url 'https://developer.huawei.com/repo/' }
// Required for react-native-background-fetch
maven { url("${project(':react-native-background-fetch').projectDir}/libs") }
}
}
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
this issue still persist
Could not determine the dependencies of task ':app:processDebugResources'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. > Could not find any matches for com.transistorsoft:tsbackgroundfetch:+ as no versions of com.transistorsoft:tsbackgroundfetch are available. Searched in the following locations: - https://oss.sonatype.org/content/repositories/snapshots/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://repo.maven.apache.org/maven2/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - file:/Users/kmamtora/Documents/GitHub/r-native/AwesomeProject/node_modules/jsc-android/dist/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://dl.google.com/dl/android/maven2/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml - https://www.jitpack.io/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml Required by: project :app > project :react-native-background-fetch * Try:
This is not an issue for the plug-in, but an issue with your own app’s Config. See post above for solutions.
I have just added the line below in android/build.gradle. It does not require anything extra.
allprojects {
repositories {
// Required for react-native-background-fetch
maven { url("${project(':react-native-background-fetch').projectDir}/libs") }
}
}