1Instruction of running webrtc_unity_plugin on Android Unity 2 31. On Linux machine, compile target webrtc_unity_plugin. 4 Checkout WebRTC codebase: fetch --nohooks webrtc_android 5 If you already have a checkout for linux, add target_os=”android” into .gclient file. 6 Run gclient sync 7 Run gn args out/Android, and again set target_os=”android” in the args.gn 8 Run ninja -C out/Android webrtc_unity_plugin 9 102. On Linux machine, build target libwebrtc_unity under webrtc checkout. This is the java code for webrtc to work on Android. 11 123. Copy libwebrtc_unity.jar and libwebrtc_unity_plugin.so into Unity project folder, under Assets/Plugins/Android folder. 13 144. Rename libwebrtc_unity_plugin.so to libjingle_peerconnection_so.so. This is hacky, and the purpose is to let the java code in libwebrtc_unity.jar to find their JNI implementations. Simultaneously, in your C# wrapper script for the native plugin libjingle_peerconnection_so.so, the dll_path should be set to “jingle_peerconnection_so”. 15 165. In the Unity Main Scene’s Start method, write the following code to initialize the Java environment for webrtc (otherwise, webrtc will not be able to access audio device or camera from C++ code): 17 18#if UNITY_ANDROID 19 AndroidJavaClass playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); 20 AndroidJavaObject activity = playerClass.GetStatic<AndroidJavaObject>("currentActivity"); 21 AndroidJavaClass utilityClass = new AndroidJavaClass("org.webrtc.UnityUtility"); 22 utilityClass.CallStatic("InitializePeerConncectionFactory", new object[1] { activity }); 23#endif 24 256. Compile the unity project into an APK, and decompile the apk using apktool that you can download from https://ibotpeaches.github.io/Apktool/ 26 Run apktool d apkname.apk. 27Then copy the AndroidManifest.xml in the decompiled folder to the Assets/Plugins/Android folder, and add two lines: 28 <uses-permission android:name="android.permission.RECORD_AUDIO" /> 29 <uses-permission android:name="android.permission.CAMERA" /> 30 31The purpose of using apktool is to get a well-written android manifest xml file. If you know how to write manifest file from scratch, you can skip using apktool. 32 337. Compile the unity project into an APK again and deploy it to an android device. 34