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.

WebRTCModule.java:3: error: package android.support.annotation does not exist

See original GitHub issue

I am trying to do a release build ./gradlew assembleRelease and getting this error

> Task :react-native-webrtc:compileReleaseJavaWithJavac FAILED
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java:3: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java:13: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java:7: error: package android.support.v4.view does not exist
import android.support.v4.view.ViewCompat;
                              ^
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/DataChannelObserver.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java:102: error: cannot find symbol
    void sendEvent(String eventName, @Nullable WritableMap params) {
                                      ^
  symbol:   class Nullable
  location: class WebRTCModule
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java:480: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class PeerConnectionObserver
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java:501: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class PeerConnectionObserver
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java:514: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class PeerConnectionObserver
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/DataChannelObserver.java:31: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class DataChannelObserver
/Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java:590: error: cannot find symbol
                && ViewCompat.isAttachedToWindow(this)) {
                   ^
  symbol:   variable ViewCompat
  location: class WebRTCView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/nitsornwongsajjathiti/Documents/projects/mHealth/ayahealth/node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
10 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-webrtc:compileReleaseJavaWithJavac'.

Expected behavior

For it to build the release APK successfully

Observerd behavior

It is throwing an above error. However building debug APK is successful.

Platform information

MacOS, trying to build for android

  • React Native version: 0.60.4
  • Plugin version: 1.69.2
  • OS: Android
  • OS version: 9

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
blueorange589commented, May 21, 2020

When android.useAndroidX=true android.enableJetifier=true in gradle.properties file, Studio requires some androidx libraries for the build.

I could finally able to build, after following changes removed import android.support.annotation.Nullable; added import androidx.annotation.Nullable; in DataChannelObserver.java, PeerConnectionObserver.java, WebRTCModule.java

In addition to these, following changes are required in WebRTCView.java removed import android.annotation.SuppressLint; removed SuppressLint("WrongCall")

removed import android.support.v4.view.ViewCompat; added import androidx.core.view.ViewCompat;

Finally app level build.gradle file needs the following dependencies { implementation 'androidx.annotation:annotation:1.1.0' }

Should be good after these

1reaction
saghulcommented, Sep 10, 2019

As I said before: sorry, but I just can’t review everyone’s code. Try to simplify it and start adding the complexity gradually. I see you are using socketio. Don’t. Start by getting the user camera and rendering it in a view, then start working on the remote case.

Also: this is not the right place to ask for help, please use our community: https://react-native-webrtc.discourse.group/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : package android.support.annotation. does not exist
When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on ......
Read more >
Android builds failing, latest Androidx libraries are not ...
Hi, i have upgraded my react-native app from react-native 58.x.x, to 63.x.x and even though i have updated also all the dependencies and ......
Read more >
error package com android annotations does not exist - Edureka
This is my class: import com.android.annotations.NonNullByDefault; @NonNullByDefault public final class Log { ... } The build.gradle file:
Read more >
React Native — How to handle an app with both pre-AndroidX ...
java:3 : error: package android.support.annotation does not existimport android.support.annotation.IntDef;^/Users/vsts/agent/2.153 ...
Read more >
w9IYs9 - Online Java Compiler & Debugging Tool - Ideone.com
package com.example.foodpaal; ... import android.support.design.widget.NavigationView; ... Main.java:3: error: package android.content does not exist import ...
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