Closed ZhenQian-keystone closed 5 months ago
Same here with react-native-vision-camera v4.0.5 and RN 0.74.0
Same here with react-native-vision-camera v4.0.5 and RN 0.74.0
yes, so confused , dont know how to solve that
Same here with react-native-vision-camera v4.0.5 and RN 0.74.0
Try downgrading the RN version to 0.73
Same here with react-native-vision-camera v4.0.5 and RN 0.74.0
Try downgrading the RN version to 0.73
but my rn version is 0.71.11, meet same issue, do you konw how to fix it
why "react-native-vision-camera": "^3.3.1" use two versions of react-native ?
> Configure project :react-native-vision-camera
[VisionCamera] react-native-worklets-core not found, Frame Processors disabled!
WARNING:The specified Android SDK Build Tools version (28.0.3) is ignored, as it is below the minimum supported
version (30.0.3) for Android Gradle Plugin 7.3.1.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING:The specified Android SDK Build Tools version (29.0.2) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.3.1.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '29.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING:The specified Android SDK Build Tools version (26.0.3) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.3.1.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING:The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.3.1.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING:The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.3.1.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<-------------> 0% EXECUTING [5m 49s]
> Resolve files of :app:releaseRuntimeClasspath > react-android-0.74.1-release.aar > 20.5 MiB/143.7 MiB downloaded
> IDLE
> IDLE
> Resolve files of :app:releaseRuntimeClasspath
> IDLE
> Resolve files of :app:releaseRuntimeClasspath > react-native-0.71.0-rc.0-release.aar > 16.2 MiB/70.2 MiB downloaded
> Resolve files of :app:releaseRuntimeClasspath
> Resolve files of :app:releaseRuntimeClasspath
> Resolve files of :app:releaseRuntimeClasspath
> Resolve files of :app:releaseRuntimeClasspath
here is my gradle version and kotlin version
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 1.8.0_202 (Oracle Corporation 25.202-b08)
OS: Mac OS X 10.16 x86_64
First, let's analyze the issue.
Although your react-native version in package.json
is less than 0.74, and your react-native-vision-camera is ^3.3.1
(the version in yarn.lock is 3.9.2), everything seems normal and there shouldn't be any problems. However, the issue still occurs.
This is because, before react-native-vision-camera v3.3.1, the android/build.gradle module in the project used the following syntax:
implementation 'com.facebook.react:react-android:+'
This line means that when building the camera package, if you don't explicitly specify the react-android version in the build.gradle file of your react-native project, Gradle will download the latest version 0.74.1 from the Maven repository at https://mvnrepository.com/artifact/com.facebook.react/react-android. This is the reason for the bug.
The solution is to use the "force" keyword to enforce the use of react-android version 0.71.11:
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-android:0.71.11"
}
}
}
However, sometimes the problem may not be resolved with just this step. If you are maintaining an older project that uses both react-native-vision-camera and other react-native libraries like react-native-webview, you may encounter "duplicate class" issues.
For example:
https://github.com/react-native-webview/react-native-webview/blob/master/android/build.gradle#L107
implementation 'com.facebook.react:react-native:+'
This will download the latest version 0.71.0-rc.0 dependency from https://mvnrepository.com/artifact/com.facebook.react/react-native.
If your project has a similar situation, it will be difficult to compile because although your project references react-native and react-android, which seem unrelated, they actually have the same package names and class names. Hence, the compiler will fail.
To solve this problem, you need to change all occurrences of implementation 'com.facebook.react:react-native:+'
to implementation 'com.facebook.react:react-android:+'
to resolve the package and class name conflicts.
Usually, we don't need to manually adjust the build.gradle file of each package. We can add the following code at the end of the android/build.gradle file in the root directory:
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useTarget group: details.requested.group, name: 'react-android', version: '0.71.11'
}
}
}
}
This code will change all occurrences of implementation 'com.facebook.react:react-native:+'
to implementation 'com.facebook.react:react-android:0.71.11'
by renaming, resolving the package and class name conflicts.
First, let's analyze the issue.
Although your react-native version in
package.json
is less than 0.74, and your react-native-vision-camera is ^3.3.1
(the version in yarn.lock is 3.9.2), everything seems normal and there shouldn't be any problems. However, the issue still occurs.This is because, before react-native-vision-camera v3.3.1, the android/build.gradle module in the project used the following syntax:
implementation 'com.facebook.react:react-android:+'
This line means that when building the camera package, if you don't explicitly specify the react-android version in the build.gradle file of your react-native project, Gradle will download the latest version 0.74.1 from the Maven repository at https://mvnrepository.com/artifact/com.facebook.react/react-android. This is the reason for the bug.
The solution is to use the "force" keyword to enforce the use of react-android version 0.71.11:
allprojects { configurations.all { resolutionStrategy { force "com.facebook.react:react-android:0.71.11" } } }
However, sometimes the problem may not be resolved with just this step. If you are maintaining an older project that uses both react-native-vision-camera and other react-native libraries like react-native-webview, you may encounter "duplicate class" issues.
For example:
https://github.com/react-native-webview/react-native-webview/blob/master/android/build.gradle#L107
implementation 'com.facebook.react:react-native:+'
This will download the latest version 0.71.0-rc.0 dependency from https://mvnrepository.com/artifact/com.facebook.react/react-native.If your project has a similar situation, it will be difficult to compile because although your project references react-native and react-android, which seem unrelated, they actually have the same package names and class names. Hence, the compiler will fail.
To solve this problem, you need to change all occurrences of implementation
'com.facebook.react:react-native:+'
toimplementation 'com.facebook.react:react-android:+'
to resolve the package and class name conflicts.Usually, we don't need to manually adjust the build.gradle file of each package. We can add the following code at the end of the android/build.gradle file in the root directory:
subprojects { project.configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') { details.useTarget group: details.requested.group, name: 'react-android', version: '0.71.11' } } } }
This code will change all occurrences of implementation
'com.facebook.react:react-native:+'
to implementation'com.facebook.react:react-android:0.71.11'
by renaming, resolving the package and class name conflicts.
thanks , it works for me, you save me life
my rn 0.74.1
Try downgrading the RN version
VisionCamera does not support RN 0.74 yet. See this issue for updates: https://github.com/mrousavy/react-native-vision-camera/issues/2614 and consider sponsoring if you need this sooner.
Hey, what worked for me was:
cd android
./gradlew clean
!Reason of error: "Requested internal only, but not enough space": This indicates that the device or emulator you are using to run your React Native project does not have enough internal storage space to install the APK.
How were you trying to build the app?
i am trying to build android, i am not use camera v4 , but i still meet same this error. this error confuse me a lot of time , who can save my life.
this is error
i use camera v3
here is my computer env
Full build logs
Project dependencies
VisionCamera Version
react-native-vision-camera@^3.3.1: version "3.9.2"
Target platforms
Android
Operating system
MacOS
Can you build the VisionCamera Example app?
Yes, I can successfully build the Example app here
Additional information