PSA: AppRTCMobile can now be developed in Android Studio

2,120 views
Skip to first unread message

sa...@webrtc.org

unread,
Feb 20, 2017, 6:57:36 AM2/20/17
to discuss-webrtc
If you checkout the most recent version WebRTC, it is now possible to generate an Android Studio project for AppRTCMobile. Please also make sure to run "gclient sync" to ensure you are using the most recent Chromium checkout. You can currently only use this method to develop Java code.

How to
  1. Have an Android checkout of WebRTC. For instructions: https://webrtc.org/native-code/android/
  2. Run command:
  3. build/android/gradle/generate_gradle.py --output-directory $PWD/out/Debug --target "//webrtc/examples:AppRTCMobile" --use-gradle-process-resources
  4. The project will be generated in out/Debug/gradle.
  5. Import the project in Android Studio 2.2. (Do not just open it.)
  6. When asked to use Gradle wrapper, press "OK".
  7. Ensure target webrtc>examples>AppRTCMobile is selected and press Run.
  8. AppRTCMobile should now start on the device.

Rex Lin

unread,
Feb 23, 2017, 2:43:08 AM2/23/17
to discuss-webrtc
good news

Vadim

unread,
Mar 3, 2017, 6:15:13 AM3/3/17
to discuss-webrtc
Hi there.
I checked this script and got this log:
Traceback (most recent call last):
 File "./build/android/gradle/generate_gradle.py", line 704, in <module>
    main()
  File "./build/android/gradle/generate_gradle.py", line 625, in main
    build_vars = _ReadBuildVars(output_dir)
  File "./build/android/gradle/generate_gradle.py", line 96, in _ReadBuildVars
    with open(os.path.join(output_dir, 'build_vars.txt')) as f:
IOError: [Errno 2] No such file or directory: '/home/vfite/development/webrtc/webrtc-src/src/out/Debug/build_vars.txt'

How can I resolve this error?
Default target build via GN works as expected.
By the way Is there a way how can I import and compile native jni/c++ code in Android studio?

Sami Kalliomäki

unread,
Mar 3, 2017, 8:59:23 AM3/3/17
to discuss-webrtc
Have you generated the project in out/Debug directory and compiled it at least once?

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/c2284649-36c4-4534-b081-99e304709c8f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Vadim

unread,
Mar 3, 2017, 10:53:21 AM3/3/17
to discuss-webrtc
No/
So, I should compile target firstly?
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Sami Kalliomäki

unread,
Mar 6, 2017, 3:24:48 AM3/6/17
to discuss-webrtc
Yes. And no it is not possible to compile jni/c++ inside Android Studio right now.

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/d525ee44-c397-4daa-b508-bd0c17d28b91%40googlegroups.com.

Rex Lin

unread,
Mar 9, 2017, 1:11:23 AM3/9/17
to discuss-webrtc
I use the command:
build/android/gradle/generate_gradle.py --output-directory $PWD/out/Debug --target "//webrtc/examples:AppRTCMobile" --use-gradle-process-resources

to generate the android studio project. But it occur this error:
Traceback (most recent call last):
  File "build/android/gradle/generate_gradle.py", line 746, in <module>
    main()
  File "build/android/gradle/generate_gradle.py", line 661, in main
    'Gradle resources does not yet work without --split-projects.')
AssertionError: Gradle resources does not yet work without --split-projects.

what's wrong?

在 2017年2月20日星期一 UTC+8下午7:57:36,sa...@webrtc.org写道:

Sami Kalliomäki

unread,
Mar 13, 2017, 8:10:02 AM3/13/17
to discuss-webrtc
Hi,

You should now pass "--split-projects" as well. However, there is a small bug in Chromium that prevents the build from working correctly right now. I uploaded a CL to fix this and it will hopefully land soon: https://codereview.chromium.org/2747723002/

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.

Rex Lin

unread,
Mar 13, 2017, 10:04:14 PM3/13/17
to discuss-webrtc
Thinks your reply!

here is another error after run the generate_gradle.py

../../third_party/ijar/zip.cc:36:10: fatal error: 'limits' file not found
#include <limits>
         ^~~~~~~~
1 error generated.


and, I run the commond : build_aar.py , same error like:

../../third_party/ijar/classfile.cc:35:10: fatal error: 'set' file not found
#include <set>
         ^~~~~
1 error generated.


Is there some problems with the libary "ijar" ?


在 2017年3月13日星期一 UTC+8下午8:10:02,Sami Kalliomäki写道:
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Sami Kalliomäki

unread,
Mar 14, 2017, 4:02:05 AM3/14/17
to discuss-webrtc
You probably have something wrong with your build environment. I suggest you try to do a normal build first.

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/ac29b95f-5ae9-4dfd-89a9-ac935b14672a%40googlegroups.com.

Ashly Jose

unread,
Mar 30, 2017, 6:54:08 AM3/30/17
to discuss-webrtc
I followed your steps and it generated gradle directory, but when I tried to open the AppRtcMobile app using android emulator, it throws following exception

"Error:Could not list contents of '/work/software/webrtc/src/out/Debug/gradle/webrtc/examples/AppRTCMobile/symlinked-libs/armeabi/secondary_abi_libraries'. Couldn't follow symbolic link."
I noticed that the above symbolic links are pointing to out/Debug directory and the link is not present there, Also noticed that all symbolic links in gradle/webrtc/examples/AppRTCMobile/symlinked-libs/armeabi are broken, 
what could be the reason. my system configuration are

ubuntu 14.04 x86 64 bit  
webrtc latest commit id -07ce245895f0ece9d080ed72a1c2781d5da54023

used following command to create build 
gn gen out/Debug --args='target_os="android" target_cpu="arm"'
 
 Am i  Missing something here, Appreciate your help  to solve this issue 

Idan Shperling

unread,
Apr 18, 2017, 4:08:39 AM4/18/17
to discuss-webrtc
I'm facing a problem with R.java file looking for a package name : dummy.package
I'm working on ubuntu 14.04 , android studio 2.3.1, sdk 25, build-tools 25.0.2

thanks in advance!
Idan



בתאריך יום חמישי, 30 במרץ 2017 בשעה 03:54:08 UTC-7, מאת Ashly Jose:

Sami Kalliomäki

unread,
Apr 18, 2017, 4:12:11 AM4/18/17
to discuss-webrtc
Please use Android Studio 2.2 for now, Android Studio 2.3 is not yet supported.

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/8e831f36-ec9f-40f2-b5be-f370cb958a77%40googlegroups.com.

Elad Alon

unread,
Apr 19, 2017, 3:34:24 AM4/19/17
to discuss-webrtc
I'm also having the same problem with Android Studio 2.3. As for 2.2, the links on http://tools.android.com/download/studio/builds/2-2-2 seem to be broken.

Elad Alon

unread,
Apr 19, 2017, 3:34:25 AM4/19/17
to discuss-webrtc
In addition to Idan's problem, which I hope moving to Android Studio 2.2 would solve (as posted separately, all links to version 2.2 are currently broken, btw), I have another problem:
(Please see attachments. The comments in the attachment make the problem clear.)
Screenshot from 2017-04-18 13-44-10.png

Idan Shperling

unread,
Apr 20, 2017, 2:43:36 AM4/20/17
to discuss-webrtc
I can confirm that building the AppRTCMobile worked for me in Android studio 2.3.1.

Elad alon I've made this steps:

export PATH=`pwd`/depot_tools:"$PATH"
mkdir webrtc-checkout
cd webrtc-checkout  
fetch --nohooks --no-history webrtc_android
cd src
git fetch --tags
git checkout branch-heads/57  
gclient sync
./build/install-build-deps.sh 
./build/install-build-deps-android.sh
gn gen out/Debug --args='target_os="android" target_cpu="arm" is_debug=false dcheck_always_on=true symbol_level=1 is_component_build=false' 
ninja -C out/Debug
ninja -C out/Debug AppRTCMobile
build/android/gradle/generate_gradle.py --output-directory $PWD/out/Debug --target "//webrtc/examples:AppRTCMobile" --use-gradle-process-resources --split-projects

and then made a final touch in the manifest file becasue the dummy.package.

please make sure you are following all the steps.






Sami Kalliomäki

unread,
Apr 20, 2017, 8:13:35 AM4/20/17
to discuss-webrtc
Hi,

Android Studio 2.3 should now work with the latest checkout.

Regards,
Sami Kalliomäki

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/fb14f199-9ef0-4b60-a9ef-4e94ca587a45%40googlegroups.com.

Pratibha

unread,
Apr 25, 2017, 6:27:12 AM4/25/17
to discuss-webrtc
Should i have to do all this configuration, i have downloaded android webRtc sample app from https://github.com/njovy/AppRTCDemo that run, cant i change its configuration to run it on my own application? i am new here, Help me? i am not understanding flow how to integrate it in my android app? i want implement video call.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Sami Kalliomäki

unread,
Apr 25, 2017, 6:43:00 AM4/25/17
to discuss-webrtc
The Github page you linked is not part of WebRTC. For official instructions on how to compile AppRTCMobile see: https://webrtc.org/native-code/android/

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/61608f09-4c7f-4e1f-9c02-d4aec841183c%40googlegroups.com.

Hieu than hieu

unread,
Jul 29, 2018, 2:55:01 PM7/29/18
to discuss-webrtc
Hi, my env:
ubutu 18.04 java 8 open jdk, android gradle 4.6, android plugin 3.2.0-beta02, android studio 3.1.3
-Following https://webrtc.org/native-code/android/
-I got error and can't build any more:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':build.android.buildhooks.build_hooks_android_java:compileDebugJavaWithJavac'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)

### I build with ninja in sucessfully, but when I add new class Java in android project, I don't know how to add libraries into GN file
How can I do it?( in case of coding without Android Studio), for example: Could'n add "android.support.annotation.Nullable" in to a new added class java.
Reply all
Reply to author
Forward
0 new messages