Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – More than one file was found with OS independent path ‘lib/armeabi-v7a/libfbjni.so’

Posted on November 11, 2022 By

Solution 1 :

==OLD SOLUTION==

The fix for current react-native

We’re suggesting all users of React Native to apply this fix to your top level build.gradle file as follows:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    // ...
}


allprojects {
    repositories {
+       exclusiveContent {
+           // We get React Native's Android binaries exclusively through npm,
+           // from a local Maven repo inside node_modules/react-native/.
+           // (The use of exclusiveContent prevents looking elsewhere like Maven Central
+           // and potentially getting a wrong version.)
+           filter {
+               includeGroup "com.facebook.react"
+           }
+           forRepository {
+               maven {
+                   // NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
+                   url "$rootDir/../node_modules/react-native/android"
+               }
+           }
+       }
        // ...
    }
}

What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules.

Once you update your app to React Native v0.71.0, this fix won’t be needed anymore.

==NEW SOLUTION==

We have prepared releases for all the main versions of react-native with an hotfix:

0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5

️ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7

0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5

️ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5

️ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5

️ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3

️ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4

️ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5

By updating to these patch versions, your Android build should start working again.

To do so, in your package.json change react-native’s version to the relevant new patch (ex. if you are on 0.64.3, change to 0.64.4) and run yarn install. No other changes should be necessary, but you might want to clean your android artifacts with a cd android && ./gradlew clean before trying to re-run your Android app.

READ  [FIXED] android - Can't write data into database firebase firestore
Powered by Inline Related Posts

== Fix for older react-native (< 0.63) ==

The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.

You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.

If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent.

Add this in the allprojects area of your android/buld.gradle file.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

Instead of using exclusiveContent, the hotfix must force the version of React Native. The recommended hotfix shells out to node to read your current version of react-native. If you hard code the version of react-native, when you upgrade your project in the future, your build will fail if you forget to remove this hotfix.

Note that this fix is fragile as the location of your package.json could be different if you are in a monorepo, and node might not be available if you use a node package manager like nvm.

Source: https://github.com/facebook/react-native/issues/35210

Solution 2 :

Under allProjects-build.gradle-repositories add below code.
It worked for an old project that I have been working on.

 exclusiveContent {
       filter {
           includeGroup "com.facebook.react"
       }
       forRepository {
           maven {
               // NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
               url "$rootDir/../node_modules/react-native/android"
           }
       }
   }

Solution 3 :

See below article if you are on older react-native

Fix for older react-native (< 0.63)

The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.

READ  [FIXED] android - Could not find org.koin:koin-test:2.0.1
Powered by Inline Related Posts

You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.

If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent.

Add this in the allprojects area of your android/buld.gradle file.

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

Problem :

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.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

In app/build.gradle file

packagingOptions {
  pickFirst 'lib/x86/libc++_shared.so'
  pickFirst 'lib/x86_64/libc++_shared.so'
  pickFirst 'lib/arm64-v8a/libc++_shared.so'
  pickFirst 'lib/armeabi-v7a/libc++_shared.so'

}
still giving error….

Tried

In app/build.gradle file

    packagingOptions {
      pickFirst 'lib/x86/libfbjni.so'
      pickFirst 'lib/x86_64/libfbjni.so'
      pickFirst 'lib/arm64-v8a/libfbjni.so'
      pickFirst 'lib/armeabi-v7a/libfbjni.so'
   }

but it giving following error
More than one file was found with OS independent path ‘lib/armeabi-v7a/libc++_shared.so’.

Comments

Comment posted by Try this

Try this

Comment posted by Aitch

Thank you so much, seems to work. Can you explain, why it happens now, because we did not change our setup and on day (I think yesterday or day before) it suddenly failed.

Comment posted by github.com/facebook/react-native/issues/35210

If you are on an older version of react native like I am ( 0.60.6 ), hopefully this will provide clues

Comment posted by RamaProg

@aitch it’s explained in the source. “On November 4th 2022 we published the React Native version 0.71.0-rc0, the first release candidate for the 71 release series, on several public repositories. Specifically, this version was also published on Maven Central as we’re updating our artifacts distribution strategy (technical details are explained below). This event resulted in build failures for Android on several users as they ended up downloading the wrong React Native version (0.71.0-rc0 instead of the version they were using in their project, say 0.68.0).”

READ  [FIXED] react native - API GET request URL works on Brave/Chrome but not on fetch()
Powered by Inline Related Posts

Android Tags:android, build.gradle, react-native

Post navigation

Previous Post: Do you have to pay for MyNetDiary?
Next Post: [FIXED] Simple Cucumber Test is not running on Sample Android Project

Related Posts

[FIXED] Android studio 3.6 give an redline for android_screenOrientation=”portrait”, need to change android_screenOrientation=”fullSensor”? Android
[FIXED] android – Failed to load resource In cordova fresh app Android
[FIXED] java – NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory Android
[FIXED] android – Google maps markers not updating in google_maps_flutter Android
[FIXED] android – How to close flutter time picker using Navigator after successful http request? Android
[FIXED] android – Reducing AOSP kernel image size Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme