Apprtcmobile Android studio project, source code construction

Time:2019-10-10

Attention: The construction method provided by the official website is toxic.
Official website https://webrtc.org/native-cod…:
build/android/gradle/generate_gradle.py –output-directory $PWD/out/Debug –target “//examples:AppRTCMobile” –use-gradle-process-resources –split-projects –canary
Several pits:
1. Use the — Canary parameter
This will make the generated project dependent on the cannary version of as. If the webrtc source code you use to compile is particularly new, when importing the as version of windows computer, you will find that the as version of Engineering dependent is newer than the as version of Windows computer (the version of Windows computer is updated to the latest version of stable intelligently), and if the configuration of as version above build gradle is forcibly changed. You may encounter all kinds of exotic flower problems.
So: if the webrtc source code is particularly new, then the stable version will be generated when it is generated. How to generate it? Canary is removed, the default is stable version; if the webrtc source code is older, no problem, or use – canary, nothing needs to be changed.
2. The generated project is very weird. The generated gradle folder is imported directly into as, resulting in the problem that various source codes can not be found, and Google’s own tools can not be found.
First of all, the source code of the project and jar so are still in the source code directory of webrtc, and have not been copied to the gradle folder. We have to copy the corresponding webrtc source code directory to windows in order to let the project find the source code. In addition, exclude in build. gradle at all levels, if the directory where the org. webrtc. audio package is located, leading to some sub-projects can not find the org. webrtc. audio package, exclude the relevant content of exclude, but there will be other problems.
So… does not recommend using the generated directory directly, but should use the / SRC / example / androidapp directory in the webrtc source code as a blueprint, combining the various build. gradles in / SRC / example / aarproject and
https://github.com/duqian2919…
https://github.com/Piasy/webrtc
Build. gradle inside
Ultimately build the as project that you can use

Attention should be paid to the construction of the project:
1. First, create a HelloWorld project without C + + support. Don’t import the androidapp folder project directly from the source code. There will be all kinds of strange problems.
2. Copy the res resource files and Android Mainifest files in the Androidapp directory to the project directory
3. The only jar file on which the project depends is the autobanh.jar file. Remember to export it from the src/out/ebug/lib.java directory and add it to the project. The same is true for libjingle_peerconnection_so.so. Of course, add a directory indicating the platform.

Engineering catalogue structure

After the as project compiles properly and is able to connect to the default appr.tc server, if you want to connect the AppRTCMobile to the server you deploy (for example, https://www.zeng060.top:8081), you need to modify the following:
1. The whole project search appr.tc, all changed to https://www.zeng060.top:8081 about four or five places
2. Open the file org. appspot. apprtc. RoomParameters Fetcher. Java and remove the connection. setDoOutput (true);
Then recompile and you can connect to the server you deployed

Ps: Windows computers need to turn over the wall, and it’s all over the world. Otherwise, they’ll get upset again… (Similar effects can be achieved by changing host files)

The latest version separates the app application part from the webrtc library part. The GitHub link is as follows
https://github.com/zengpeace/…
Welcome to Star if you feel good about it.

Recommended Today

C# – RSA encryption and decryption

RSA encryption and decryption — public key encryption and private key decryption public class RSATool { public string Encrypt(string strText, string strPublicKey) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(strPublicKey); byte[] byteText = Encoding.UTF8.GetBytes(strText); byte[] byteEntry = rsa.Encrypt(byteText, false); return Convert.ToBase64String(byteEntry); } public string Decrypt(string strEntryText,string strPrivateKey) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(strPrivateKey); byte[] byteEntry […]