On android build I receive the errors:
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.2.
Show Details
Affected Modules: react-native-firebase
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
android/build.gradle
:buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
// N/A
android/app/build.gradle
:apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
react-native bundle
with the correct arguments during the Android buildapply from: "../../node_modules/react-native/react.gradle"
line.project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
/**
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.ntproject"
minSdkVersion 16
targetSdkVersion 28
versionCode 42
versionName "1.1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation(project(':react-native-firebase'))
implementation (project(':lottie-react-native'))
implementation (project(':react-native-fetch-blob'))
implementation (project(':react-native-camera'))
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
}
implementation project(':react-native-image-picker')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.android.support:appcompat-v7:28.0.0')
implementation 'com.facebook.react:react-native'
implementation('com.android.support:multidex:1.0.1')
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation('com.google.firebase:firebase-core:16.0.7') {
exclude group: 'com.google.android.gms', module: 'play-services-base'
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
ADD_SOMETHING_HERE
e.g. iOS 10 or Android API 28N/A
N/A
N/A
React Native
version:0.50.3ADD_SOMETHING_HERE
React Native Firebase
library version:5.2.3ADD_SOMETHING_HERE
Firebase
module(s) you're using that has the issue:TypeScript
?N/A
ExpoKit
?ExpoKit
N/A
Think react-native-firebase
is great? Please consider supporting the project with any of the below:
React Native Firebase
and Invertase
on TwitterAny fix or workaround for this?
Any update on this ?
I was not able to solve this problem, so I had to find another library
Thanks @biancaFarcas which library are using now?
Adding the following in the build.gradle file compiles for me.
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.0'
}
}
see fix
it doesn鈥檛 work for me. I have the same error and can't compile. any suggestion?
Pin your versions in main build.gradle https://github.com/invertase/react-native-firebase-starter/blob/master/android/build.gradle#L3
then reference them everywhere else like so https://github.com/react-native-community/react-native-device-info/blob/master/example/android/app/build.gradle#L143
basically any time I see "resolutionStrategy" in a gradle file, and it's not because there are two legitimately different implementations you can choose from (like camera with mlkit or basic) it tells me that gradle versions haven't been pinned so modules don't know what to use and you get clashes
@Solly74 now I am using react-native-push-notification as I only needed react-native-firebase for notifications module.
I faced the exact same error with my project.
I can't explain why but after using npm instead of using yarn, I was able to build successfully.
probably could not be a solution but hope it would work for you.
any progress on this? i'm close to dumping firebase :/
This isn't a problem, as near as I can tell. @timomeara did you follow my recommendations? it builds, it works...but you have to pin the dependencies in your gradle config
This isn't a problem, as near as I can tell. @timomeara did you follow my recommendations? it builds, it works...but you have to pin the dependencies in your gradle config
thanks mike- i did fix it, but pinning the deps didn't help. i basically started from scratch :)
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Adding the following in the build.gradle file compiles for me.
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.0'
}
}see fix
Just to be specific build.gradle of react-native-firebase
Put this line
implementation "com.google.code.findbugs:jsr305:3.0.2"
in node-module/react-native-firebase/android/build.gradle into dependencies block
Put this line
implementation "com.google.code.findbugs:jsr305:3.0.2"
in node-module/react-native-firebase/android/build.gradle into dependencies block
No, don't do that. It's dangerous advice. Why? That change will be overridden every time you install packages, and it will just fail immediately if your CI is building clean (as it should). Don't ever modify node_modules directly or advise others to do so.
If you must fiddle with node_modules, use "patch_package".
In this case, the gradle resolution strategy suggestions in your apps build.gradle are sufficient
There is a valid workaround on this issue, and in general I don't believe this module is responsible. Here's a demo from react-native init through a running app, no problem: https://github.com/mikehardy/rnfbdemo
@mikehardy can you please provide an example for pinning the dependency ?
already in the thread - https://github.com/invertase/react-native-firebase/issues/1954#issuecomment-492737681
Thanks for the quick reply
@mikehardy I was not able to get what has to be pinned exactly,
I have not stated com.google.code.findbugs:jsr305 as a dependancy in ap pgradlew file
gradle handles dependencies recursively. can you imagine if you specified each dependency without gradle handling it? You probably depend on more than 100 projects.
But if you have resolution conflicts between different versions of the same recursive dependency (like jsr305) then you have to instruct gradle to pin the dependency even though it wasn't specified by you
Gradle education is beyond the scope of this project though - the comment above should work, and if not gradle has ample documentation, with company Q&A on stackoverflow
Adding this to app/build.gradle
dependencies made it work for me
implementation('com.squareup.okhttp3:okhttp:3.12.1') { force = true }
implementation('com.squareup.okio:okio:1.15.0') { force = true }
implementation('com.google.code.findbugs:jsr305:3.0.2') { force = true}
@mikehardy I really appreciate your help here. I think most of us are Android n00bs.
I tried pinning versions in a variety of ways and either got the same errors or more errors 馃う鈥嶁檪
Would you mind being _really specific_ about what I should do to fix this issue?
Here are my dependency errors
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:{strictly 3.0.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:{strictly 2.5.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okio:okio:{strictly 1.6.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.5.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okio:okio:1.6.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.7.5.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:2.0.1.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.2.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.3.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okio:okio:1.15.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.squareup.okio:okio:1.13.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.2.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:{strictly 3.0.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:{strictly 2.5.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okio:okio:{strictly 1.6.0}.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.5.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okio:okio:1.6.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.7.5.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:2.0.1.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.2.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okhttp:okhttp:2.3.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okio:okio:1.15.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.squareup.okio:okio:1.13.0.
Show Details
Affected Modules: react-native-firebase
ERROR: Unable to resolve dependency for ':react-native-firebase@release/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:3.0.2.
Show Details
Affected Modules: react-native-firebase
ERROR: Failed to resolve: com.facebook.react:react-native:0.59.10
Show in Project Structure dialog
Affected Modules: app
WARNING: API 'variant.getPreBuild()' is obsolete and has been replaced with 'variant.getPreBuildProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getPreBuild(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: react-native-fabric, react-native-share-extension
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: react-native-share-extension
I've tried adding things to android/build.gradle and android/app/build.grade, but I'm not sure I was doing any of it right.
For example, I was hunting around in React Native 60 and found these versions:
OKHTTP_VERSION=3.12.1
api("com.google.code.findbugs:jsr305:3.0.2")
api("com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}")
api("com.squareup.okio:okio:1.15.0")
Among other things, I tried adding this to my android/app/build.grade and it did nothing.
implementation('com.squareup.okhttp3:okhttp:3.12.1') { force = true }
implementation('com.squareup.okio:okio:1.15.0') { force = true }
implementation('com.google.code.findbugs:jsr305:3.0.2') { force = true}
Another thing I tried is inside android/build.gradle adding the following to dependencies, but this caused more errors.
classpath 'com.google.code.findbugs:jsr305:3.0.2'
I also tried in android/app/build.gradle but this didnt do anything either.
android {
configurations.all {
resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.12.1'
resolutionStrategy.force 'com.squareup.okio:okio:1.15.0'
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
}
}
I'd really appreciate any help -- I've been spinning my wheels all day and exhausted all of the google searched I can think of 馃檹
I tried deleting react-native-firebase
and everything worked so its definitely something to do with the library.
I did some search in this library and I couldn't find anywhere that the okhttp
dependency was specified...
'. /gradlew :app:deoendencies" is how you can debug gradle resolution the problem is in between rnfb and some other library
FAILURE: Build failed with an exception.
* What went wrong:
Task 'deoendencies' not found in project ':app'. Some candidates are: 'dependencies'.
Sounds like a type-o somewhere but I can't find this anywhere in my project or node_modules... 馃
Oh that was in the command! lol 馃う鈥嶁檪
./gradlew :app:dependencies
results in BUILD SUCCESSFUL
I'm trying to track down this one single error that I get when I sync with gradle files.
ERROR: Unable to resolve dependency for ':react-native-firebase@debug/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:{strictly 3.0.0}.
Show Details
Affected Modules: react-native-firebase
These are the only instances of that package in the dependency tree...
+--- com.facebook.react:react-native:+ -> 0.20.1
| +--- com.google.code.findbugs:jsr305:3.0.0
| +--- com.facebook.stetho:stetho-okhttp:1.2.0
| | +--- com.google.code.findbugs:jsr305:2.0.1 -> 3.0.0
| | +--- com.facebook.stetho:stetho:1.2.0
| | | +--- com.google.code.findbugs:jsr305:2.0.1 -> 3.0.0
| | | \--- commons-cli:commons-cli:1.2
| | \--- com.squareup.okhttp:okhttp:2.2.0 -> 2.5.0
| | \--- com.squareup.okio:okio:1.6.0
+--- com.google.code.findbugs:jsr305:{strictly 3.0.0} -> 3.0.0 (c)
@ccorcos no idea, I can't reproduce. You might make a new sample project from react-native init on github that reproduces the problem and share it. All I know is that some one is saying they want findbugs:jsr305 strictly as 3.0.0 and someone else wants 3.0.2 so it's failing. Which library is doing that? no idea from the information provided
Well I think I figured it out https://github.com/facebook/react-native/issues/12309
+--- com.facebook.react:react-native:+ -> 0.20.1
I was installing react-native from a fork that has a small fix for iOS share extensions and the /android
directory wasn't built...
https://github.com/facebook/react-native/pull/26077/files
Anyways, it works now! Thanks for the help 馃槃
Most helpful comment
Adding the following in the build.gradle file compiles for me.
see fix