react-native-image-picker: image picker manager is null

After installing react-native-image-picker according to this documentation the emulator is displaying this-

 react-native-image-picker: NativeModule.ImagePickerManager is null. To fix this issue try these steps:
ΓÇó Run `react-native link react-native-image-picker` in the project root.
ΓÇó Rebuild and re-run the app.
ΓÇó If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
ΓÇó Check that the library was linked correctly when you used the link command by running through the manual installation instructions in the README.
* If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README.
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-image-picker

And to follow the above instruction, I try to rebuild the app but after installing the image picker app is not building. Command prompt is giving this

> Task :app:processDebugManifest FAILED
E:\imageTest\android\app\src\debug\AndroidManifest.xml:22:18-91 Error:
        Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
        is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
        Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 3s
22 actionable tasks: 1 executed, 21 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

And this is my AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.test">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
 
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 40 (1 by maintainers)

Most upvoted comments

I also have the same problem while using expo I have tried running react-native link react-native-image-picker did not work for me. This is what worked for me.

  1. Unistall the latest version npm uninstall react-native-image-picker
  2. Installed version 0.28.0 npm install react-native-image-picker@0.28.0 --save react-native link react-native-image-picker

I also have the same problem . This is what worked for me.

Unistall the latest version npm uninstall react-native-image-picker Installed version 0.28.0 npm install react-native-image-picker@0.28.0 --save react-native link react-native-image-picker

Having same issue using expo.

This NPM package had lots of problems though I have tried using it. I encountered react-native-image-picker: NativeModule.ImagePickerManager is null. To fix this issue try these steps: ΓÇó Run react-native link react-native-image-picker in the project root. most of the time.

I’m using 1.1.x for react-native-image picker, and react-native 59.9. I was able to get around this error in tests by mocking the native module. In my Jest setup script, I included this, and the tests passed:

jest.mock('react-native-image-picker', () => ({
}));

I am also getting the top message “react-native-image-picker: Native Module.ImagePickerManager is null.” I manually installed the xcodeproject file to my libraries. And did all the previous steps but still can’t get it to work.

What can I do? What can I do?

I fixed it by running ‘pod install’, for RN >= 60

I also have the same problem while using expo I have tried running react-native link react-native-image-picker did not work for me. This is what worked for me.

1. Unistall the latest version
   `npm uninstall react-native-image-picker`

2. Installed version 0.28.0
   `npm install react-native-image-picker@0.28.0 --save`
   `react-native link react-native-image-picker`

I had the same problem after an upgrade from RN0.059 to 0.63 and version 0.28 of the lib did work for me on iOS but on android as the version is not on androidX it failed. Installing version 1.1.0 of RN-image-picker worked on both ios and android. So thank you very much for giving the idea of downgrading the lib.

In conclusion : yarn add react-native-image-picker@1.1.0 resolved it for me

I fixed it finally 3-unlinked the package 2-uninstalled the package 3-install again 4- (the most important ) is you need permission obviously , so I added these to AndroidManifest.xml in android/app/src/main : <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

i have some problem; react native version 0.62

then i use npx react-native init AwesomeTSProject --template react-native-template-typescript to init a new Project

then copy all files(except android and ios) to to new project.

it work.

is this issue still happened?