Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLVED] Android/iOS build fail w/undefined items/files latest version #4154

Closed
1 of 5 tasks
Deepak-147 opened this issue Aug 27, 2020 · 27 comments
Closed
1 of 5 tasks
Assignees
Labels
impact: build-error Behaviour causing build failure

Comments

@Deepak-147
Copy link

Issue

Gradle Task fails on building the app.

A problem occurred configuring project ':@react-native-firebase_ml-vision'.
compileSdkVersion is not specified.

This is happening post release of new version 7.4.1 for @react-native-firebase/ml-vision
Build succeeds when using previous version 7.3.2

Environment

Click To Expand

react-native info output:

 System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 125.05 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.9.0 - /usr/local/bin/node
    npm: 6.10.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29, 30
      Build Tools: 23.0.1, 27.0.3, 28.0.0, 28.0.3, 29.0.2, 30.0.1
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


@Deepak-147 Deepak-147 added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Aug 27, 2020
@biancaFarcasSP
Copy link

I had this issue with react-native-firebase-storage, and now I am stuck with the same problem on react-native-firebase-firestore.

@biancaFarcasSP
Copy link

For now, downgrading the library version did the trick!

@mikehardy
Copy link
Collaborator

Sure, but that's not a great solution :-). Hello @biancaFarcasSP and sorry for the hassle.
I centralized SDK version management with the latest release you can see it here:

728f418

@react-native-firebase/app is a strict dependency of @react-native-firebase/<any other package> so it should be valid to expect ../app/package.json to exist.

How is your installation of @react-native-firebase/ structured such that app and ml-vision are not next to each other?

If we solve that problem, the build will be fine.

@Nemferno
Copy link

Hi @mikehardy, I'm having similar issues at the moment. How do I see my installation of @react-native-firebase structure?

@Nemferno
Copy link

All good! I upgraded all @react-native-firebase dependencies to their latest versions using yarn.

{
    "@react-native-firebase/app": "^8.4.0",
    "@react-native-firebase/auth": "^9.1.1",
    "@react-native-firebase/crashlytics": "^8.4.1",
    "@react-native-firebase/dynamic-links": "^7.1.2",
    "@react-native-firebase/firestore": "^7.0.1",
    "@react-native-firebase/functions": "^7.1.2",
    "@react-native-firebase/messaging": "^7.1.5",
    "@react-native-firebase/storage": "^7.2.2"
}

@mikehardy
Copy link
Collaborator

I wonder if this is an npm vs yarn thing? That would not be expected, but software is always capable of surprising me...

The structure I'm talking about is:

./node_modules/
./node_modules/@react-native-firebase/
./node_modules/@react-native-firebase/app     <-- app should be here, it has package.json with versions
./node_modules/@react-native-firebase/<all other packages>   <-- these reference ../app/package.json

@Nemferno
Copy link

I'm not too sure about npm vs yarn.. What I do know is upgrading @react-native-firebase/app and other packages to the latest version helped. @biancaFarcasSP would need to give the structure you are referring to and the package.json.

@mikehardy
Copy link
Collaborator

Yes - a related bug was resolved by someone else by making sure all versions were updated to the same, and were the same across a monorepo (so that different versions didn't get installed in unexpected places - root level or package level)

@biancaFarcasSP
Copy link

@mikehardy I upgraded all firebase dependencies from package.json and it works now. However, it may be a good idea to add a note on Readme about it. It would save others some time if they want to add new firebase module to existing project.

@mikehardy
Copy link
Collaborator

I agree totally @biancaFarcasSP - first we needed to figure out exactly what was failing though, to provide specific instruction that would work - your success report for that fix is enough to go on in combination with the other reports to do that now I think, thanks for reporting back

@mikehardy
Copy link
Collaborator

I'm going to alter the title on this one and pin it to top so it's easy for people to see, but I'm also going to resolve this as I think we found the root cause and with peerDependencies set correctly I don't believe it is a code problem specifically, but I did make a docs PR to hopefully publicize it more

I appreciate everyone working with me (and each other) on this to try to pin it down

If there is some other failure mode besides not upgrading all the packages to follow peerDependencies then I will certainly re-open and we can figure it out

@mikehardy mikehardy changed the title [🔥]@react-native-firebase_ml-vision has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file [SOLVED, we think] - Android or iOS build failure with undefined items / files on latest version Aug 27, 2020
@mikehardy mikehardy removed help: needs-triage Issue needs additional investigation/triaging. platform: android Workflow: Waiting for User Response Blocked waiting for user response. labels Aug 27, 2020
@mikehardy mikehardy pinned this issue Aug 27, 2020
@mikehardy mikehardy changed the title [SOLVED, we think] - Android or iOS build failure with undefined items / files on latest version [SOLVED] Android/iOS build fail w/undefined items/files latest version Aug 27, 2020
@JiboStore
Copy link
Contributor

In my case, it is because my own app's package.json is requiring a lower version of react-native-firebase/app, thus the peer-dependency of all-other-packages are resolved to the lower version (not sure why it isn't resolved to higher version from the other-package)

Upgrading the app's package.json's react-native-firebase/app solve the issue for me

@sbrighiu
Copy link

For now, downgrading the library version did the trick!

This works everytime with firebase ..
Can someone for the love of god give me the yarn command to find out the dependencies for a particular version of package?

I know about yarn info

@mikehardy
Copy link
Collaborator

@sbrighiu I find yarn upgrade --latest actually works just about every time (or a quick revert of one version of one bleeding edge package then fixes it up) vs downgrading firebase, but that's me.

I think this might help https://www.npmjs.com/package/install-peerdeps but in general the way to find out if your peer dependencies are off is that when you do a yarn it complains at you?

@sbrighiu
Copy link

yeah... but when you're working with react native and expo and .. some old 3rd party packages, it is better to avoid automation :)

@mikehardy
Copy link
Collaborator

No disagreement from me there @sbrighiu

I have these two commands spread out in my monorepo one at top, the rest at package level, one is to scan for what would happen (then I can go see the release notes) and one makes it happen - with a couple specific packages hard-downgraded)


(base) mike@kunashir:~/work/Kullki/ksocialscore (rebranding) % cat ./package.json */*/package.json|egrep "package-outdated|package-update"
    "package-outdated": "(yarn outdated || true) && npx lerna run package-outdated",
    "package-update": "yarn upgrade --latest && npx lerna run package-update",
    "package-outdated": "yarn outdated || true",
    "package-update": "yarn upgrade --latest",
    "package-outdated": "yarn outdated || true",
    "package-update": "yarn upgrade --latest && yarn add [email protected]",
    "package-outdated": "yarn outdated || true",
    "package-update": "yarn upgrade --latest",
    "package-outdated": "yarn outdated || true && (cd ios && pod repo update && pod outdated) || true",
    "package-update": "yarn upgrade --latest && yarn add metro@^0.62.0 metro-react-native-babel-preset@^0.62.0 && (cd ios && pod install --repo-update && pod update) || true",

@sbrighiu
Copy link

sbrighiu commented Aug 28, 2020

uh :( .. add some patch_package patches and this could be fun-er

@mikehardy
Copy link
Collaborator

Plenty of those. And the work project moves right along. It's all a house of cards though, don't forget npx react-native-clean-project in your CI pipeline ;-)

@sbrighiu
Copy link

sbrighiu commented Aug 30, 2020

Here is a nice one :) made it myself
"screenshot:android": "adb exec-out screencap -p > ~/Desktop/android-$(date \"+%Y-%m-%d_%H-%M-%S\")_$(jot -r 1 2000 65000).png",

also,

   "postinstall": "patch-package --include 'package.json' && npx pod-install && npx jetify",
    "clean-everything": "watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && rm -f package-lock.json && rm -f yarn.lock && npm cache verify && npm install && expo r -c"

@Saidfatah
Copy link

as it was already mentioned upgrading the packages versions is the solution , dunno what's with the team behind but they pomp new versions almost every week

@mikehardy
Copy link
Collaborator

It's a massive project, and it's the community mostly proposing PRs, then it's me working to integrate them as quickly as possible and voila, we've got bugfixes and new features coming out all the time :-). I do wish sometimes that the upstream firebase team would slow down a bit, we're still behind them with regards to covering all their APIs...

@luatnd
Copy link

luatnd commented Sep 23, 2020

I used fixed version in package.json with @react-native-firebase/*@6.3.4
After add @react-native-firebase/remote-config without specify version, it's installed as @9.x.x
That lead to the error.
I must force its version to @react-native-firebase/[email protected]
....
In my experience, I would prevent the major & minor version, only patch version was allowed to update.

@mikehardy
Copy link
Collaborator

mikehardy commented Sep 23, 2020

@luatnd that is terrible advice. Update all packages to current stable. Don't downgrade.

@luatnd
Copy link

luatnd commented Sep 24, 2020

@luatnd that is terrible advice. Update all packages to current stable. Don't downgrade.

In the past, I have some issue with version conflicting between @react-native-firebase/* packages,
Every time we upgrade a new version, I need to re-test all the test cases, I intend to do this only a few times per year.

@mikehardy
Copy link
Collaborator

Version conflict problems happen if you don't upgrade them all.
Your release cycle is not my concern, I'm a library maintainer. I merge bugfixes and release them. New versions contain more bugfixes. You can do what you like but you should not recommend to library users to downgrade and thus not obtain bug fixes. That's terrible advice and I will call it such

@joaom182
Copy link

Similar issue here.

* What went wrong:
A problem occurred evaluating project ':react-native-firebase_firestore'.
> :react-native-firebase_firestore has not defined a default in project.ext.'react-native'.versions.android.compileSdk in its build.gradle file.

Module packge versions:

"@react-native-firebase/app": "^7.3.1",
"@react-native-firebase/firestore": "^7.8.7",
"@react-native-firebase/auth": "^7.1.0",
"@react-native-firebase/messaging": "^7.9.1",
"@react-native-firebase/remote-config": "^7.2.2",

@mikehardy
Copy link
Collaborator

@joaom182 old versions, upgrade - the problem will resolve

@mikehardy mikehardy unpinned this issue Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: build-error Behaviour causing build failure
Projects
None yet
Development

No branches or pull requests

9 participants