AgoraIO-Community / Agora-Flutter-Quickstart

Quickstart guide for the Agora Flutter SDK(Android/iOS)
MIT License
509 stars 192 forks source link

RTCEngine creation failing with java.lang.reflect.InvocationTargetException and couldn't find "libagora-ffmpeg.so" #226

Closed ayushmi closed 3 years ago

ayushmi commented 3 years ago

I followed the starter code to implement the demo live stream.

This is my initAgoraRtcEngine function:

Future<void> _initAgoraRtcEngine() async {
    _engine = await RtcEngine.createWithConfig(new RtcEngineConfig(appId));
    await _engine.enableVideo();
    await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
    if (widget.isBroadcaster) {
      await _engine.setClientRole(ClientRole.Broadcaster);
    } else {
      await _engine.setClientRole(ClientRole.Audience);
    }
  }

I am using agora_rtc_engine: ^3.3.1

Here RTC Engine creation is failing with following errors:

W/System.err( 9610): java.lang.reflect.InvocationTargetException W/System.err( 9610): at java.lang.reflect.Method.invoke(Native Method) W/System.err( 9610): at io.agora.agora_rtc_engine.AgoraRtcEnginePlugin.onMethodCall(AgoraRtcEnginePlugin.kt:115) W/System.err( 9610): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230) W/System.err( 9610): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) W/System.err( 9610): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) W/System.err( 9610): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err( 9610): at android.os.MessageQueue.next(MessageQueue.java:336) W/System.err( 9610): at android.os.Looper.loop(Looper.java:174) W/System.err( 9610): at android.app.ActivityThread.main(ActivityThread.java:7682) W/System.err( 9610): at java.lang.reflect.Method.invoke(Native Method) W/System.err( 9610): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) W/System.err( 9610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) W/System.err( 9610): Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.app==/base.apk", zip file "/data/app/com.app==/base.apk"],nativeLibraryDirectories=[/data/app/com.app==/lib/arm64, /data/app/com.app==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]] couldn't find "libagora-ffmpeg.so" W/System.err( 9610): at java.lang.Runtime.loadLibrary0(Runtime.java:1067) W/System.err( 9610): at java.lang.Runtime.loadLibrary0(Runtime.java:1007) W/System.err( 9610): at java.lang.System.loadLibrary(System.java:1667) W/System.err( 9610): at io.agora.rtc.internal.RtcEngineImpl.loadNativeLibrary(RtcEngineImpl.java:163) W/System.err( 9610): at io.agora.rtc.internal.RtcEngineImpl.initializeNativeLibs(RtcEngineImpl.java:199) W/System.err( 9610): at io.agora.rtc.RtcEngine.create(RtcEngine.java:89) W/System.err( 9610): at io.agora.rtc.base.RtcEngineManager.create(RtcEngine.kt:368) W/System.err( 9610): ... 12 more E/flutter ( 9610): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: MissingPluginException(No implementation found for method create on channel agora_rtc_engine) E/flutter ( 9610): #0 MethodChannel._invokeMethod E/flutter ( 9610):

LichKing-2234 commented 3 years ago

run ./gradlew clean and try again

ayushmi commented 3 years ago

Thanks this worked!