-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Gradle build failed for the Expo Android Fix Pre-release #546
Comments
Thanks for the bug report! react-native-vision-camera/android/build.gradle Lines 113 to 115 in 7206a79
|
I ran into the same issue (without expo), the solution works for me, thanks. |
@mrousavy can we please get a update with the change you need mentioned since expo people can't touch the gradle❤️🙏🏻 |
@haibert Did you find a workaround for that ? |
@yoann84 im pretty sure yesterday my build was successful while using the expo .11 version with no problems, are you on expo v43 ? |
Sorry but what is expo 0.11 ? yes i'm on sdk43 and on android I have similar error. When I try to fix one I got another one and wtih expo as we can't modify gradle files and configuration even if I found a workaround it won't work in production |
I can't for my life build the android app on SDK 44 (custom dev client)
|
@hirbod Marc is working on a fix he just doesn't have enough time to dedicate to backwards compatibility.(because I think vision camera works fine with RN .65 and above) He might work on the fix when he finds free time. Also soon expo will allow us to have more complex managed work flow which will make supporting complex modules like this easier. This is according to the man him self Evan Bacon. Hope this gives you some hope until a fix is provided either from Marc or from expo! |
@haibert I just talked with Marc today via twitter. He tries to fix this in the holidays. |
Thanks, @mrousavy. I stumbled upon similar error messages for other libraries. I ended up with: Finally, I managed to build for Android, using Expo's
I hope this helps anyone. Kind regards,
|
@sandlands I can confirm that this approach works! Thanks a lot Sander. to do this you will need the following config plugin. Courtesy of @mercyaj const { withProjectBuildGradle } = require('@expo/config-plugins')
const setCompileSdkVersion = (buildGradle, sdkVersion) => {
const regexpCompileSdkVersion = /\bcompileSdkVersion\s*=\s*(\d+)/
const match = buildGradle.match(regexpCompileSdkVersion)
if (match) {
const existingVersion = parseInt(match[1], 10)
if (existingVersion < sdkVersion) {
buildGradle = buildGradle.replace(
/\bcompileSdkVersion\s*=\s*\d+/,
`compileSdkVersion = ${sdkVersion}`
)
} else {
throw new Error(`minSdkVersion is already >= ${sdkVersion}`)
}
}
return buildGradle
}
module.exports = (config, sdkVersion) => {
return withProjectBuildGradle(config, (config) => {
if (config.modResults.language === 'groovy') {
config.modResults.contents = setCompileSdkVersion(
config.modResults.contents,
sdkVersion
)
} else {
throw new Error(
"Can't set minSdkVersion in the project build.gradle, because it's not groovy"
)
}
return config
})
} Then inside of app.json "plugins": [
"react-native-vision-camera",
["./withCompileSdkVersion", 31]
] //---------------IN APP.JSON----------------- BTW you can use the most recent release with these diffs, you dont need to use 2.9.4. |
That’s awesome news. I will try this later. Haven’t been able to build Android for days |
@haibert did you still use the same patch file or did you edit it? I see the patchfile contains change to the minSdkVersion from 31 to 30 and you supplied a configPlugin to set 30 to 31 :D |
@hirbod yea I made a mistake there lol but it still works. You can ignore that step if you use the plugin.. and I should also mention I had to turn off hermes engine on android or else the build was still failing.. make sure you dont have "jsEngine": "hermes" in your app.jsons android property. |
Oh no. I won’t build my app without Hermes this time. Going to wait for a real fix by Marc |
What were you trying to do?
Trying to install Vision Camera on android and do a successful expo build.
Reproduceable Code
No response
What happened instead?
FAILURE: Build failed with an exception.
Relevant log output
[stderr] FAILURE: Build failed with an exception. [stderr] * What went wrong: [stderr] Execution failed for task ':app:mergeDebugNativeLibs'. [stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade [stderr] > More than one file was found with OS independent path 'lib/x86_64/libreactnativejni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake [stderr] * Try: [stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. [stderr] * Get more help at https://help.gradle.org [stderr] BUILD FAILED in 7m 29s🐛
Device
iPhone 12 iOS 14
VisionCamera Version
2.9.4@expo
Additional information
The text was updated successfully, but these errors were encountered: