react-native-player icon indicating copy to clipboard operation
react-native-player copied to clipboard

An error occurs when compiling the apk file

Open kitolog opened this issue 9 years ago • 18 comments

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

kitolog avatar Nov 20 '15 07:11 kitolog

I got the same issue :( what's happening?

peterwilli avatar Nov 29 '15 21:11 peterwilli

+1

mikedizon avatar Dec 02 '15 18:12 mikedizon

A bit of information: when I comment onLoadCompleted method, project building works fine, but a part of player functionality not working

kitolog avatar Dec 03 '15 14:12 kitolog

The master works for me. Can you guys try the new version 0.0.8 ?

xeodou avatar Dec 05 '15 08:12 xeodou

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 avatar Dec 09 '15 07:12 flyingmate

@flyingmate I identify the bug with your log, can you input more ? Have your register in your Application class

xeodou avatar Dec 09 '15 07:12 xeodou

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 avatar Dec 09 '15 09:12 flyingmate

@flyingmate I got your issue.

xeodou avatar Dec 09 '15 10:12 xeodou

@flyingmate please try 0.0.9

xeodou avatar Dec 09 '15 10:12 xeodou

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

flyingmate avatar Dec 09 '15 13:12 flyingmate

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

xeodou avatar Dec 09 '15 13:12 xeodou

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.

Leekao avatar May 09 '16 12:05 Leekao

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 avatar May 09 '16 14:05 xeodou

@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 avatar May 09 '16 14:05 Leekao

@Leekao This library used for react-native and depend on some other Java library. And i am sorry i can give you any suggestion.

xeodou avatar May 09 '16 14:05 xeodou

Is this libs just for Audio?

openGeeksLab avatar May 10 '16 12:05 openGeeksLab

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.

Leekao avatar May 10 '16 16:05 Leekao

@mobileDevNativeCross Can work for video, but i haven't implement this.

xeodou avatar May 11 '16 04:05 xeodou