Reputation: 365
Im building a music player and I need to get the metadata of the songs, for that im using this package:
react-native-get-music-files
, following its instruction to install it says:
it says add to the list returned by the getPackages()
method, but i think my android studio version is different and i dont have it, so dont know where to put it:
this is my MainActivity:
package com.musicplayer;
import com.reactlibrary.RNReatNativeGetMusicFilesPackage;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import expo.modules.splashscreen.singletons.SplashScreen;
import expo.modules.splashscreen.SplashScreenImageResizeMode;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// SplashScreen.show(...) has to be called after super.onCreate(...)
// Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "main";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
Upvotes: 3
Views: 2107
Reputation: 31
I had a similar issue when installing react-native-add-shorcut
.
I found someone who had the same issue and was told that this was changed in RN +29. Now, getPackages()
is found in android/app/main/java/[...]/MainApplication.java
.
Still, when I added it there I got an error saying the package was being added twice. It Seems like this is taken care of in /android/app/build/generated/[...]/PackageList.java
after running react-native run-android
. I simply didn't add it and now it's working for me.
Upvotes: 3