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 66 forks source link

RNAndroidAudioStore TypeError: Cannot read property 'getSongs' of undefined #74

Closed Joshmatjjen closed 4 years ago

Joshmatjjen commented 4 years ago

I have being trying to fix this for over close to a week... the import files are showing ... MusicFiles.getAll, work properly but when i try to use RNAndroidAudioStore, any working function i pass to it is seen has undefined...

Joshmatjjen commented 4 years ago

I installed with:

  1. yarn add https://github.com/cinder92/react-native-get-music-files.git --save (Not fixed)
  2. yarn add git+https://github.com/Drazail/react-native-get-music-files.git#development (Not fixed)
  3. yarn add react-native-get-music-files --save (Not Fixed)

Here is my code:

Files.js

import MusicFiles, { RNAndroidAudioStore } from 'react-native-get-music-files';

function getThem() { RNAndroidAudioStore.getSongByPath({ songUri: 'file:///storage/emulated/0/Wave Downloader/YouTube/Audios/Shine.mp3', cover: true, }); }

android/build.gradle `buildscript { ext { buildToolsVersion = "28.0.3" minSdkVersion = 17 compileSdkVersion = 28 targetSdkVersion = 28 } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.2")

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}`

android/settings.gradle

include ':react-native-media-thumbnail' project(':react-native-media-thumbnail').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-media-thumbnail/android')

**MainApplication***

import com.cinder92.musicfiles.RNReactNativeGetMusicFilesPackage; import com.RNFetchBlob.RNFetchBlobPackage;

new RNReactNativeGetMusicFilesPackage(); new RNAndroidStorePackage();

Joshmatjjen commented 4 years ago

I have fixed it.. Thanks