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

🐛 Execution failed for task ':react-native-vision-camera:extractAARHeaders'. #1443

Closed
3 of 4 tasks
amiraabdelmalek opened this issue Jan 31, 2023 · 40 comments · Fixed by #1466
Closed
3 of 4 tasks
Labels
🐛 bug Something isn't working

Comments

@amiraabdelmalek
Copy link

What were you trying to do?

hello, i'am trying to build my react native app for android. and i have this build error. can someone please help me with this.
here's the versions that i'm using.

"react-native": "0.70.6",
"react-native-vision-camera": "^2.15.3",
"react-native-reanimated": "^2.13.0",

my build.gradle:

buildToolsVersion = "32.0.0"
minSdkVersion = 21
compileSdkVersion = 32
targetSdkVersion = 32
googlePlayServicesAuthVersion = "20.2.0"

dependencies {
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath 'com.google.gms:google-services:4.3.13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0
}

Reproduceable Code

No response

What happened instead?

  • What went wrong:
    Execution failed for task ':react-native-vision-camera:extractAARHeaders'.

Could not resolve all files for configuration ':react-native-vision-camera:extractHeaders'.
Could not find com.facebook.fbjni:fbjni:headers.
Searched in the following locations:
- file:/Users/macos/job-actu-candidate/node_modules/react-native/android/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- file:/Users/macos/job-actu-candidate/node_modules/jsc-android/dist/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://dl.google.com/dl/android/maven2/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://www.jitpack.io/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://maven.google.com/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
Required by:
project :react-native-vision-camera

Relevant log output

No response

Device

Pixel 3a API 32

VisionCamera Version

^2.15.3

Additional information

@amiraabdelmalek amiraabdelmalek added the 🐛 bug Something isn't working label Jan 31, 2023
@jpabara
Copy link

jpabara commented Jan 31, 2023

Same issue here

@art9mid
Copy link

art9mid commented Jan 31, 2023

Any updates ?

@yormy
Copy link

yormy commented Jan 31, 2023

Same here, running on an expo-bare workflow

@MahammadNuriyev62
Copy link

i have exactly the same issue!

@kyrsanter
Copy link

The same
RN 0.70.1
"react-native-vision-camera": {
"version": "2.15.3",

@meth0xy
Copy link

meth0xy commented Jan 31, 2023

same here. Running React Native CLI Project
RN: 0.69.7
react-native-vision-camera: 2.15.3

@yormy
Copy link

yormy commented Jan 31, 2023

Partly resolved by following the instructions for : https://docs.expo.dev/versions/latest/sdk/reanimated/
Compiles and builds and app starts, but I have some js errors elsewhere
(2.15.2)
`
ERROR ReferenceError: Can't find variable: __detect
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication()

This happens due to the useFrameProcessor
But no clue why yet
`

@jpabara
Copy link

jpabara commented Jan 31, 2023

@yormy you mean this part?

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['react-native-reanimated/plugin'],
  };
};

@jpabara
Copy link

jpabara commented Jan 31, 2023

I managed to make it work, I know downgrading is not the best idea, but version 2.15.3 of react-native-vision-camera was released yesterday. So I changed package.json to version 2.15.2 and it worked fine after 3 attempts of building the app

@yormy
Copy link

yormy commented Jan 31, 2023

Did you make other changes. I get js errors on the scanner.tsx code
Do you use react-native setup or expo bare setup ?

@jpabara
Copy link

jpabara commented Jan 31, 2023

Nothing else, I use react-native CLI

Versions are:
"react-native": "0.67.5", "react": "17.0.2", "react-native-vision-camera": "2.15.2",

@SeongwoonHong
Copy link

i'm running into the same issue. any luck so far?

@MahammadNuriyev62
Copy link

MahammadNuriyev62 commented Jan 31, 2023

could only fix by downgrading
react-native-reanimated to exactly 2.10.0
react-native-vision-camera to exactly 2.14.1

i have:

"react-native": "0.70.5"
"react": "18.1.0"

waiting for better solutions from you)

@GSFZamai
Copy link

GSFZamai commented Jan 31, 2023

I managed to make it work, I know downgrading is not the best idea, but version 2.15.3 of react-native-vision-camera was released yesterday. So I changed package.json to version 2.15.2 and it worked fine after 3 attempts of building the app

This worked for me. Updated today and got this error, before downgrading to 2.15.2, build successfully

@jbohman
Copy link

jbohman commented Jan 31, 2023

I have this issue on version 2.15.2. It worked to build locally but in CI it started to fail. After running ./gradlew clean it started to happen for me locally as well.

@SeongwoonHong
Copy link

SeongwoonHong commented Jan 31, 2023

"react-native": "0.66.5"
"react-native-vision-camera": "2.14.1"
"react-native-reanimated": "^2.10.0"
This DID NOT work for me.

"react-native": "0.66.5"
"react-native-vision-camera": "2.14.1"
"react-native-reanimated": "2.10.0"
This DID NOT work for me

"react-native": "0.66.5"
"react-native-vision-camera": "2.15.2"
"react-native-reanimated": "^2.10.0"
This DID NOT work for me

I'm getting

Execution failed for task ':react-native-vision-camera:extractJNIFiles'.
> Cannot expand ZIP 'some path/node_modules/react-native-reanimated/android/react-native-reanimated-66-hermes.aar' as it does not exist.

@art9mid
Copy link

art9mid commented Jan 31, 2023

@mrousavy check pls

@mrousavy
Copy link
Owner

@mrousavy check pls

stop tagging me. I can't reproduce this error, VisionCamera builds in all my apps. If you want to fix this, submit a PR (or pay me to fix it).

@marcelmeulemans
Copy link

Downgrading to 2.15.2 should work but it seems that sometimes/somehow the 2.15.3 build.gradle file is cached somewhere. Check the the last lines match the 2.15.2 version:
https://github.com/mrousavy/react-native-vision-camera/blob/v2.15.2/android/build.gradle#L601
For me a yarn cache clean and yarn add react-native-vision-camera@2.15.2 restored the correct build.gradle.

@rembleram
Copy link

The same
RN: 0.70.6
react-native-vision-camera: 2.15.3

`
Build file '/xxx/node_modules/react-native-vision-camera/android/build.gradle' line: 596

  • What went wrong:
    Execution failed for task ':react-native-vision-camera:extractAARHeaders'.

Could not resolve all files for configuration ':react-native-vision-camera:extractHeaders'.
Could not find com.facebook.fbjni:fbjni:headers.
Searched in the following locations:
- file:/xxx/node_modules/react-native/android/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- file:/xxx/node_modules/jsc-android/dist/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://dl.google.com/dl/android/maven2/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
- https://www.jitpack.io/com/facebook/fbjni/fbjni/headers/fbjni-headers.pom
Required by:
project :react-native-vision-camera

`

@SeongwoonHong
Copy link

@marcelmeulemans hmm I'm getting this error

> Configure project :react-native-reanimated
Native libs debug enabled: false
Android gradle plugin: 4.2.0
Gradle: 6.9
building Reanimated2

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> com.android.builder.errors.EvalIssueException: CMake '3.18.1' was not found in SDK, PATH, or by cmake.dir property.

Have you come across this before?
react-native-reanimated: "2.10.0" and react-native-vision-camera: "2.15.2"

@ravin-amplework
Copy link

WORKED FOR ME >>
downgrad to 2.15.1

@amiraabdelmalek
Copy link
Author

Did you make other changes. I get js errors on the scanner.tsx code Do you use react-native setup or expo bare setup ?

No I use react native cli setup

@zzz08900
Copy link
Contributor

zzz08900 commented Feb 1, 2023

So it seems 2.15.3 breaks on RN < 0.71?
I'll give a try and see what's going on

But for some of the problems in this thread, like CMake '3.18.1' was not found, probably has nothing to do with react-native-vision-camera.


OK I think I see the problem.
Version 2.15.3 does break on RN < 0.71

So here's the plan for anyone on RN < 0.71:
Plan A: you can safely downgrade react-native-vision-camera to 2.15.2, since 2.15.3 is only there to support RN 0.71
Plan B: you edit react-native-vision-camera/android/build.gradle, search for extractHeaders("com.facebook.fbjni:fbjni:headers:+") and replace it with extractHeaders("com.facebook.fbjni:fbjni:+:headers")
(you can see the difference, can't you? If anyone feel like it they can open a PR with this single-line change I already did it.)

It's probably a typo when they made the fix for RN 0.71

On a side note, if you are using 2.14.x and reanimated 2.1x.x, you need to bump your react-native-vision-camera to 2.15.2

@amiraabdelmalek
Copy link
Author

Downgrading to 2.15.2 worked for me.
"react-native-reanimated": "^2.13.0",
"react-native-vision-camera": "2.15.2",
"react-native": "0.70.6",
"react": "^18.2.0",
Working with react native cli.

@mrousavy
Copy link
Owner

mrousavy commented Feb 1, 2023

Looks like this is caused by #1438 - @ChristophGr could you reproduce this error?

@ChristophGr
Copy link
Contributor

Yes. It happens in projects using rn < 0.71. but @zzz08900 fix is exactly what's wrong:
#1447

@mrousavy
Copy link
Owner

mrousavy commented Feb 1, 2023

Hey @amiraabdelmalek, I just released 2.15.4 which includes the fix from #1447, can you test if that works for you? :)

@SeongwoonHong
Copy link

I was able to resolve this after downgrading the version to 2.15.2 and wiping data on emulator

@ogard
Copy link

ogard commented Feb 2, 2023

I can confirm that fix from #1447 solves the issue.

"react-native": "0.70.6"
"react-native-vision-camera": "^2.15.4"

@krisidmisso
Copy link

I have tried all the downgrades mentioned above and for me it doesnt work. I have the same issue:

FAILURE: Build failed with an exception.

* Where:
Build file '/.../node_modules/react-native-vision-camera/android/build.gradle' line: 596

* What went wrong:
Execution failed for task ':react-native-vision-camera:extractAARHeaders'.
> Could not resolve all files for configuration ':react-native-vision-camera:extractHeaders'.
   > Could not resolve com.facebook.fbjni:fbjni:+.
     Required by:
         project :react-native-vision-camera
      > Failed to list versions for com.facebook.fbjni:fbjni.
         > Unable to load Maven meta-data from https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/maven-metadata.xml.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/maven-metadata.xml'.
               > repo.maven.apache.org: nodename nor servname provided, or not known
      > Failed to list versions for com.facebook.fbjni:fbjni.
         > Unable to load Maven meta-data from https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/maven-metadata.xml.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni/maven-metadata.xml'.
               > repo.maven.apache.org

Also #1447 is already applied since I have the latest version 2.15.4. It was working 1 week ago. Now that I tried with ./gradlew clean it doesn't work anymore.

@mrousavy Can it be related due to a change done in the aar file? Since it is always re-downloaded whenever I try to build for android

@krisidmisso
Copy link

For anyone getting stuck with this issue I got it working with the following steps:

  1. clear any cache of gradle and npm/yarn
  2. delete .lock files (package-json.lock, yarn.lock)
  3. restart pc without doing anything else (dont laugh, it works some times when you are desperate)
  4. npm install/yarn install
  5. update android/build.gradle build tools versions (from 31 to 32):
buildscript {
    ext {
        buildToolsVersion = "32.0.0"
        minSdkVersion = 21
        compileSdkVersion = 32
        targetSdkVersion = 32

        VisionCameraCodeScanner_targetSdkVersion = 32
        VisionCameraCodeScanner_compileSdkVersion = 32
       
  1. ./gradlew clean inside android folder
  2. npm run android

@jg-stack
Copy link

jg-stack commented Apr 28, 2023

Was facing the same issue with this versioning:

"react-native": "0.71.7", "react-native-vision-camera": "2.15.4"

Solved the issue by updating react-native-reanimated to v2.17.0 (the last version before they moved to v3) then doing a full react-native-clean-project

@myselfuser1
Copy link

@pavelmuratev
Copy link

What fixed the issue for us was:
./gradlew clean && ./gradlew --refresh-dependencies

@mrousavy
Copy link
Owner

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉
Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

@Soul-Clinic
Copy link

code ../react-native-project/node_modules/react-native-vision-camera/android/build.gradle

Remove or comment:

apply plugin: 'kotlin-android-extensions' 

@theprantadutta
Copy link

What fixed the issue for us was: ./gradlew clean && ./gradlew --refresh-dependencies

This works

@JocheAttah
Copy link

What fixed the issue for us was: ./gradlew clean && ./gradlew --refresh-dependencies

This worked for me too

@aakarshan-raj
Copy link

Tired of React native ecosystem 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.