xeodou / react-native-player

Media player for React Native
85 stars 19 forks source link

An error occurs when compiling the apk file #3

Open kitolog opened 8 years ago

kitolog commented 8 years ago

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

peterwilli commented 8 years ago

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

mikedizon commented 8 years ago

+1

kitolog commented 8 years ago

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

xeodou commented 8 years ago

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

flyingmate commented 8 years ago

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) 
xeodou commented 8 years ago

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

flyingmate commented 8 years ago

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.

xeodou commented 8 years ago

@flyingmate I got your issue.

xeodou commented 8 years ago

@flyingmate please try 0.0.9

flyingmate commented 8 years ago

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

xeodou commented 8 years ago

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

Leekao commented 8 years ago

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.

xeodou commented 8 years ago

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. :)

Leekao commented 8 years ago

@xeodou I hope you do, it looks like a nice project. can you recommend another react-native library for playing audio from the web?

xeodou commented 8 years ago

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

openGeeksLab commented 8 years ago

Is this libs just for Audio?

Leekao commented 8 years ago

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.

xeodou commented 8 years ago

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