I am trying to user both MediaSoup and WebRTC libraries in my app.
Separately it works flawlessly, but when trying to add both in the same project I have some conflicts.
It's either:
I add both mediasoup ('org.mediasoup.droid:mediasoup-client:3.0.8-beta-3') and webRTC ('org.webrtc:google-webrtc:1.0.32006') in my project, I can sync my gradle. But when trying to build the project, I get an error saying that I got a lot of duplicated class, as such:
Duplicate class org.webrtc.AndroidVideoDecoder found in modules jetified-google-webrtc-1.0.32006-runtime.jar (org.webrtc:google-webrtc:1.0.32006) and jetified-mediasoup-client-3.0.8-beta-3-runtime.jar (org.mediasoup.droid:mediasoup-client:3.0.8-beta-3)
I add only WebRTC library: impossible to use MediaSoup so not a solution
I add only MediaSoup. So far I can compile and even build my app, but it crashes on the first statement where I use WebRTC, on:
PeerConnectionFactory.initialize()
AS is telling me that the native lib is not found:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file ".../base.apk"],nativeLibraryDirectories=[/data/app/dev.arvuz-fuhAdJV_sT2-PQyEHP0vxg==/lib/arm64, /data/app/dev.arvuz-fuhAdJV_sT2-PQyEHP0vxg==/base.apk!/lib/arm64-v8a, /system/lib64]]] couldn't find "libjingle_peerconnection_so.so"
So, that's where I am stuck. How (is it even possible?) to use WebRTC in combination with MediaSoup libraries on Android?
I tried excluding some WebRTC module in my gradle file but couldn't achieve anything.
It's possible that the MediaSoup and webRTC dependencies are using different versions of the same library code under the hood. The namespace of these different versions could collide at runtime when the JVM tries to lookup some native method that's only present in one of the versions. If this is the case, you must use the version of MediaSoup and webRTC that share the same library version.
Related
We use Xamarin Forms and I have been tasked with integrating a 3rd party AAR library from a business partner and I don't have control over the library or its dependencies. This library itself is distributed using Maven, which works great in Android Studio but is a pain in Xamarin, and it has many dependencies on both libraries that are standard in Android as well as other proprietary libraries.
Since I only need to interact with a small portion of the public API of the main library, I've created an Android library (AAR) wrapper project in Android Studio that only exposes the functionality I need and does not use any types that do not already have bindings.
I have created an Android binding project against the AAR wrapper library, and it compiles in Visual Studio without any warnings or errors.
I've created bindings for other libraries in the past and have the Xamarin binding documentation multiple times and searched online, but the part I'm missing is how to include the required/reference JAR/AAR files in the compilation process and the final Android application. Most of the standard libraries that I need already have NuGet packages (Androidx, Google Play Services, etc)., but the binding library compiles without complaint - so how do I include the other required libraries?
Do I really have to create a binding project for each required AAR/JAR and add as a reference? I don't need to interact with the types or resources in these libraries directly from Xamarin since I only interact with the the types/methods exposed in the wrapper AAR (e.g. I don't think I really need a Xamarin binding). Is there a way to simply have Xamarin process the required AARs and JARs without creating a Xamarin binding project for every library that doesn't already have a NuGet package? There are many many dependencies which makes this theoretically possible, but not in practice. There must be an easier way...
I noticed there is an AndroidLibrary build action that the documentation says can be used to directly reference an AAR/JAR file in a Android application, but I can find no examples of how to use this in practice. What does this build action do? How is it supposed to be used? https://learn.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-items#androidaarlibrary
Thanks in advance for any help or direction on the best way to do this.
I have recently begun maintaining an Android app that is not compliant with Google's requirement for 64-bit native libraries. The app itself does not directly depend on native code but in the generated apk a native library named libcproxy gets included. I can only assume that this is needed by one of the apps dependencies but so far I have not had any luck in finding the artefact in question. The shared library also seems a bit elusive as I have not been able to find many references to it online.
Is there perchance a gradle command or similar that can shed some light on which artefact includes the library?
I have tried excluding the shared library in the hope, that I might get an unsatisfied link error but so far I have not been able to make the app crash due to missing the library.
You can display a dependency tree with :
gradlew app:dependencies
I am developing first time Android Library Project that have external dependences of different libraries like retrofit and ormlite-android. The problem i am facing right now is when i use my Android Library Project .aar file inside other project the class not found exception occur when run the code. Please can any one guide me how to fix such issues. Do i have to add external libraries reference inside my dependent app ?
I built the OpenCV 3.0 beta with extra modules. The build was without java libraries and that was the only way that I was able to build the OpenCV 3.0 beta without getting errors and there is no problem because I only need the native part.
The problem that I have is when I try to implement the text module I get an error that the library canĀ“t be resolved. The line to implement the library is this:
#include <opencv2/text.hpp>
So my question is: What can I do to resolve this problem? Do I have to move some include files to some location?
Note that OCRTesseract class (inside of opencv2/text.hpp) provides an interface with the tesseract-ocr API (v3.02.02) in C++ and it is compiled only when tesseract-ocr is correctly installed.
First of all you should compile tesseract (and its dependencies) to Android.
I'm using the commonsguy cwac-camera library, as per the demo-layout example, documented in "Working directlly with cameraview".
All is fine referencing camera/ and camera-v9/ as Android library projects in source form (I need Android 2.3 compatibility, that's what camera-v9 is for).
When I switch to using the library via JARs:
- cwac-camera-v9-0.6.8.jar only includes CameraFragment and BuildConfig classes, so I need also cwac-camera-0.6.8.jar with the other classes.
- including both JARs causes the following self-explaining error when running the project (not at compile time) Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/commonsware/cwac/camera/BuildConfig;
I could just use the source as library project, or use Gradle, but I want to know if this is a bug to open an issue on Github, or if I'm doing something wrong.
To replicate the error, just clone the demo-layout example add both .jar files to libs folder, and run the project.
No, this appears to be my fault. They must have changed something in the Gradle build process that I am using to create the JARs. I will try to fix this tomorrow. In the meantime, you could go into the cwac-camera-v9 JAR and try removing the classes in com.commonsware.cwac.camera, leaving only those classes incom.commonsware.cwac.camera.acl.
My apologies for this, and thanks for pointing it out!