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.

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

See original GitHub issue

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

  • Node.js version: 16.8.0
  • React Native version: 0.64.2 (Any higher appears to break react-native-twilio-video-webrtc…any update on handling versions newer than 0.64?)
  • React Native platform + platform version: Android API 21+ / Target 30.

react-native-twilio-video-webrtc

  • Version: yarn/npm.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
HipppBcommented, Jun 30, 2022

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

0reactions
Kafkalaschcommented, Sep 25, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: package com.android.annotations does not exist
tried to add them under dependencies, but getting > Could not find method compile() for arguments [androidx.appcompat:appcompat:1.0.2] on object ...
Read more >
Support Annotations - Android Studio Project Site
Similarly, the @NonNull annotation can be used to indicate that a given parameter (or return value) can not be null. If a local...
Read more >
Diff - platform/tools/metalava - Google Git
annotationCoverageClassReport + val printer = + if (reportFile != null) { + reportFile. ... StringDef" -> return "android.support.annotation.
Read more >
Java Examples for android.support.annotation.StringDef
void write(@Nullable StringDef stringDef) { checkAnnotationNotNull(stringDef); boolean isStringDefNullable = hasNonNullOrNullable && isNullable; ...
Read more >
Explicit Nulls - Scala 3
x.trim // error: trim is not member of String | Null ... Null to a field nor to a return type of a...
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