react-native-player
react-native-player copied to clipboard
An error occurs when compiling the apk file
Hi, when I'm running gradlew assembleRelease, I got this error: .../node_modules/react-native-player/android/player/src/main/java/com/xeodou/rctplayer/ReactAudio.java:203: error: cannot find symbol public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format, ^ symbol: class Format location: class ReactAudio .../node_modules/react-native-player/android/player/src/main/java/com/xeodou/rctplayer/ReactAudio.java:206: error: cannot find symbol sendEvent("loadCompleted", params); ^ symbol: variable params location: class ReactAudio 2 errors
I got the same issue :( what's happening?
+1
A bit of information: when I comment onLoadCompleted method, project building works fine, but a part of player functionality not working
The master works for me. Can you guys try the new version 0.0.8 ?
Build success but launching apk on genymotion failed with version 0.0.8. Got this error below, looks like onLoadCompleted method on ReactAudio.java has unknown argument types for React JS like 'long' and 'Format'. After commenting onLoadCompleted method, launching apk works.
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.RuntimeException: Got unknown argument class: long
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.buildArgumentExtractors(BaseJavaModule.java:202)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.<init>(BaseJavaModule.java:169)
at com.facebook.react.bridge.BaseJavaModule.getMethods(BaseJavaModule.java:295)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.<init>(NativeModuleRegistry.java:128)
at com.facebook.react.bridge.NativeModuleRegistry$Builder.add(NativeModuleRegistry.java:175)
at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:623)
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:595)
at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:76)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:163)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:149)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
@flyingmate I identify the bug with your log, can you input more ? Have your register in your Application class
What do you mean about registering in my Application class?
https://facebook.github.io/react-native/docs/native-modules-android.html#argument-types Looks like argument types are limited among those. I changed long to Double, Format to ReadableMap (I'm not sure this is correct) Launching apk succeed.
@flyingmate I got your issue.
@flyingmate please try 0.0.9
working great! thank you
Just curious, what's the difference between dependencies and devDependencies? React-native-player README guides --save-dev install which I've never seen from other rn libraries
It's depends the module is a tool or a library you use it, It's OK put inside of dependencies
, yes maybe better inside of dependencies
I tried implementing the library and not sure I did it right, I have two MainAcitivity.java in my project and the code in the instructions wasn't in any of them, so I just added it at the start of the class, now I get these errors while trying to build:
cannot find symbol protected void onCreate(Bundle savedInstanceState) { ^ symbol: class Bundle location: class MainActivity C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:15: error: cannot find symbol mReactRootView = new ReactRootView(this); ^ symbol: variable mReactRootView location: class MainActivity C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:15: error: cannot find symbol mReactRootView = new ReactRootView(this); ^ symbol: class ReactRootView location: class MainActivity C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:17: error: mReactInstanceManager has private access in ReactActivity mReactInstanceManager = ReactInstanceManager.builder() ^ C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:24: error: cannot find symbol .setInitialLifecycleState(LifecycleState.RESUMED) ^ symbol: variable LifecycleState location: class MainActivity C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:17: error: cannot find symbol mReactInstanceManager = ReactInstanceManager.builder() ^ symbol: variable ReactInstanceManager location: class MainActivity C:\ListenIn\android\app\src\main\java\com\listenin\MainActivity.java:27: error: mReactInstanceManager has private access in ReactActivity mReactRootView.startReactApplication(mReactInstanceManager, "doubanbook" , null);
any idea what I did wrong?
by the way, trying to compile from windows.
Hi @Leekao , this library is no longer maintain anymore. I didn't have time working on this library. I may fix it if i have time. But pull request are welcome. :)
@xeodou I hope you do, it looks like a nice project. can you recommend another react-native library for playing audio from the web?
@Leekao This library used for react-native and depend on some other Java library. And i am sorry i can give you any suggestion.
Is this libs just for Audio?
For anyone reading this and having troubles compiling to React-Native > 0.19, the Java integration has changed and instead of changing the onCreate function you need to add the package in the getPackages function, like so:
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactPlayerManager() // <--- here
);
}
Still working on actually getting it to work, but at least that's how you compile the apk.
@mobileDevNativeCross Can work for video, but i haven't implement this.