question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compile Java for :react-native-twilio-video-webrtc:compileDebugJavaWithJavac

See original GitHub issue

Steps to reproduce

Setup project for android:

  1. Install package using yarn: yarn add https://github.com/blackuy/react-native-twilio-video-webrtc

  2. Add the library to settings.gradle:
    include ':react-native-twilio-video-webrtc' project(':react-native-twilio-video-webrtc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twilio-video-webrtc/android')

demoTwilioRN____repos_private_demoTwilioRN_android__-_____settings_gradle__demoTwilioRN_
  1. Include the library in dependencies in android/app/build.gradle:

dependencies { ..... ..... ..... implementation project(path: ':react-native-twilio-video-webrtc') }

demoTwilioRN____repos_private_demoTwilioRN_android__-_app
  1. Load the package in MainApplication.java:

import com.twiliorn.library.TwilioPackage;

demoTwilioRN____repos_private_demoTwilioRN_android__-_____app_src_main_java_com_demotwiliorn_MainApplication_java__app_-3
  1. Update the getPackages() method in MainApplication.java:

protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( ... new TwilioPackage() ); }

demoTwilioRN____repos_private_demoTwilioRN_android__-_____app_src_main_java_com_demotwiliorn_MainApplication_java__app_-4
  1. Add camera and audio permissions to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-feature android:name="android.hardware.microphone" android:required="false" />

  1. (Additional) Add these two lines to proguard-rules.pro:

-keep class org.webrtc.** { *; } -keep class com.twilio.** { *; }

Expected behaviour

Build android project successfully

Actual behaviour

Compile fail demoTwilioRN____repos_private_demoTwilioRN_android__-_____app_src_main_AndroidManifest_xml__app_

Environment

  • Node.js version: 12.8.0
  • React Native version: 0.60.5
  • React Native platform + platform version: iOS 12.4, Android 9.0 API 28

react-native-twilio-video-webrtc

Version: 1.0.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
evalenzuelacommented, Dec 17, 2020

I am getting a similar error, can you help please?

> Task :react-native-twilio-video-webrtc:compileDebugJavaWithJavac FAILED
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:25: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:26: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:112: error: cannot find symbol
    @StringDef({Events.ON_CAMERA_SWITCHED,
     ^
  symbol:   class StringDef
  location: class CustomTwilioVideoView
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoViewManager.java:11: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\RNVideoViewGroup.java:13: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\RNVideoViewGroup.java:39: error: cannot find symbol
    @StringDef({ON_FRAME_DIMENSIONS_CHANGED})
     ^
  symbol:   class StringDef
  location: class RNVideoViewGroup
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioRemotePreviewManager.java:10: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioVideoPreviewManager.java:10: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoViewManager.java:73: error: cannot find symbol
    public void receiveCommand(CustomTwilioVideoView view, int commandId, @Nullable ReadableArray args) {
                                                                           ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoViewManager.java:132: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoViewManager.java:171: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioRemotePreviewManager.java:35: error: cannot find symbol
    public void setScaleType(TwilioRemotePreview view, @Nullable String scaleType) {
                                                        ^
  symbol:   class Nullable
  location: class TwilioRemotePreviewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioRemotePreviewManager.java:45: error: cannot find symbol
    public void setTrackId(TwilioRemotePreview view, @Nullable String trackSid) {
                                                      ^
  symbol:   class Nullable
  location: class TwilioRemotePreviewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioVideoPreviewManager.java:34: error: cannot find symbol
    public void setScaleType(TwilioVideoPreview view, @Nullable String scaleType) {
                                                       ^
  symbol:   class Nullable
  location: class TwilioVideoPreviewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\TwilioVideoPreviewManager.java:43: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class TwilioVideoPreviewManager
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:781: error: cannot find symbol
            public void onReconnecting(@NonNull Room room, @NonNull TwilioException twilioException) {
                                        ^
  symbol: class NonNull
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:781: error: cannot find symbol
            public void onReconnecting(@NonNull Room room, @NonNull TwilioException twilioException) {
                                                            ^
  symbol: class NonNull
D:\Project\node_modules\react-native-twilio-video-webrtc\android\src\main\java\com\twiliorn\library\CustomTwilioVideoView.java:786: error: cannot find symbol
            public void onReconnected(@NonNull Room room) {
                                       ^
  symbol: class NonNull
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
18 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-twilio-video-webrtc:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
83 actionable tasks: 2 executed, 81 up-to-date
2reactions
owenadleycommented, Jul 13, 2021

@YOEL311 you can use latest, just ensure you run ‘npx jetify’ after installing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javac - Java programming language compiler
The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.
Read more >
Can I compile Java to native code? - Stack Overflow
NB: the comments all refered to my original answer saying you can compile Java to native code with GCJ. Share.
Read more >
Compiling Java for optimal debugging - IBM
Compiling Java for optimal debugging. The type and amount of debug information included within a compiled .class file depends upon the defaults of...
Read more >
1 Compiling Java Programs - People @ EECS at UC Berkeley
The Java compiler supplied by Sun Microsystems is a program called javac on our systems. You first prepare programs in files (called source...
Read more >
Compilation and Execution of a Java Program - GeeksforGeeks
class' file. While converting the source code into the bytecode, the compiler follows the following steps: Step 1: Parse: Reads a set of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found