cinder92 / react-native-get-music-files

React Native package to get music files from local and sd for iOS and Android
MIT License
130 stars 64 forks source link

nativemodules is not defined #39

Closed ShivamRawat0l closed 4 years ago

ShivamRawat0l commented 5 years ago

Native modules are not defined in index.js of the react-native-get-music-files. cannot get property getAll of undefined

To keep the issues clean stackover flow link : https://stackoverflow.com/questions/54709843/react-native-nativemodules-not-defined-when-linking-a-library-with-it

Drazail commented 5 years ago

@ShivamRawat0l

Please advise if the solution provided on stack overflow solved this issue.

ShivamRawat0l commented 5 years ago

@Drazail Sorry but no. It didn't solved. I tried many things but it didn't work.

Drazail commented 5 years ago

@ShivamRawat0l

  1. Open up android/app/src/main/java/[...]/MainActivity.java
    • Add com.cinder92.musicfiles.RNReatNativeGetMusicFilesPackage; to the imports at the top of the file
    • Add new RNReatNativeGetMusicFilesPackage() to the list returned by the getPackages() method
  2. Append the following lines to android/settings.gradle:
    include ':react-native-get-music-files'
    project(':react-native-get-music-files').projectDir = new File(rootProject.projectDir,  '../node_modules/react-native-get-music-files/android')
  3. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-get-music-files')

if the above doesn't work either, please reproduce the issue in a public repo so we can take a closer look at it.