简体   繁体   中英

How to integrate webrtc android native library on xamarin android project?

I'm facing problem on integrating the latest WebRTC library for Android on my Xamarin Android application, using the latest version: 1.0.24139 from here

I've followed the instruction from this link .

I've also changed Transforms->Metadata.xml as follows:

<metadata>
    <!--Fix incorrect Visibility-->
    <attr path="/api/package[@name='org.webrtc']/class[@name='CameraCapturer']" name="visibility">public</attr>
    <attr path="/api/package[@name='org.webrtc']/class[@name='GlGenericDrawer']" name="visibility">public</attr>
    <attr path="/api/package[@name='org.webrtc']/class[@name='WrappedNativeVideoDecoder']" name="visibility">public</attr>
    <attr path="/api/package[@name='org.webrtc']/class[@name='WrappedNativeVideoEncoder']" name="visibility">public</attr>

   <!-- Rename StatusReport.Value.Value to StatusReport.Value.Val to avoid conflict -->
   <attr path="/api/package[@name='org.webrtc']/class[@name='StatsReport.Value']/field[@name='value']" name="name">val</attr>

   <!--.NET namespace names-->
   <attr path="/api/package[@name='org.webrtc']" name="managedName">WebRTC</attr>
</metadata>

Xamarin Android binding project successfully built and generated dll .

But when I reference this project to my Xamarin android project, it throws an exception during build as the screenshot below:

在此处输入图片说明

But I've able to build successfully with the older version: 1.0.19742

Can Anyone help, please? I want to build a project with the latest WebRTC library for Android.

I try to do the same thing as you. Try two things :

  • Set the min Android SDK to 26 as mentioned in the error.
  • Put <AndroidEnableDesugar>true</AndroidEnableDesugar> in your Android project file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM