blackuy / react-native-twilio-video-webrtc

Twilio Video (WebRTC) for React Native
https://www.twilio.com/docs/video
MIT License
608 stars 403 forks source link

Build Error: Nullable, NotNull, Support.Annotation, and StringDef #583

Open mmatlock-tminus opened 2 years ago

mmatlock-tminus commented 2 years ago

Steps to reproduce

  1. Follow the installation steps (including proguard rules, etc)
  2. Attempt to run ./gradlew bundleRelease

Expected behaviour

Application builds on android.

Actual behaviour

Android build errors out on ./gradlew bundleRelease. 18 errors during compile, cannot find symbol @NonNull, @Nullable, @StringDef, due to package android.support.annotation supposedly not existing. We are using Jetifier, and I have tried the solutions recommended in #221 but have had no success.

Build errors below:

Execution failed for task ':react-native-twilio-video-webrtc:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

*/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;
                                 ^
*/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;
                                 ^
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/RNVideoViewGroup.java:38: error: cannot find symbol
    @StringDef({ON_FRAME_DIMENSIONS_CHANGED})
     ^
  symbol:   class StringDef
  location: class RNVideoViewGroup
*/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;
                                 ^
*/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;
                                 ^
*/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;
                                 ^
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java:122: error: cannot find symbol
    @StringDef({Events.ON_CAMERA_SWITCHED,
     ^
  symbol:   class StringDef
  location: class CustomTwilioVideoView
*/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;
                                 ^
*/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
*/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
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoViewManager.java:74: error: cannot find symbol
    public void receiveCommand(CustomTwilioVideoView view, int commandId, @Nullable ReadableArray args) {
                                                                           ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoViewManager.java:146: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoViewManager.java:186: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CustomTwilioVideoViewManager
*/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
*/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
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java:864: error: cannot find symbol
            public void onReconnecting(@NonNull Room room, @NonNull TwilioException twilioException) {
                                        ^
  symbol: class NonNull
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java:864: error: cannot find symbol
            public void onReconnecting(@NonNull Room room, @NonNull TwilioException twilioException) {
                                                            ^
  symbol: class NonNull
*/node_modules/react-native-twilio-video-webrtc/android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java:869: 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

Environment

react-native-twilio-video-webrtc

marqroldan commented 2 years ago

Go back to the root of the project and do npx jetify

Clean your android folder, then build try building again

mmatlock-tminus commented 2 years ago

Unfortunately as mentioned above the project already uses jetifier in its toolchain. Additionally, we use Yarn and not NPM.

mmatlock-tminus commented 2 years ago

We have cleaned build folder a number of times, with no change.

pratik007kumar commented 2 years ago

i am getting same issue on build

.../Projects/mobile-dev/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

augustosamame commented 2 years ago

+1

oyesaxena commented 2 years ago

Facing same issue while upgrading RN version from .0.64.2 to 0.68.0

mason-t3h commented 2 years ago

+1

HipppB commented 2 years ago

+1

HipppB commented 2 years ago

After trying many things to solve the error I found one that worked for me, it is not ideal but if it can help someone : Directly in the modules, in react-native-twilio-video-webrtc/android/src replace all imports android.support.annotation. by androidx.annotation.

It makes it compatible with androidx (Usually the job of jetifier but not this time)

I have also added implementation 'com.android.support:support-annotations:+' in my dependencies app build grade but I'm not sure if it helps (I won't remove it because it works and I don't want to break everything)

EDIT : I've just seen that PR #433 does exactly this

Kafkalasch commented 2 years ago

using @marqroldan trick by calling npx jetify in the root folder did the trick for me

fabiendem commented 1 year ago

Fixed by https://github.com/blackuy/react-native-twilio-video-webrtc/pull/636