gradle build - :react-native-video:compileDebugJavaWithJavac FAILED

See original GitHub issue

Bug

> Task :react-native-video:compileDebugJavaWithJavac FAILED
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java:3: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
                                 ^
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java:5: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
                                 ^
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ResizeMode.java:3: error: package android.support.annotation does not exist
import android.support.annotation.IntDef;
                                 ^
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ResizeMode.java:33: error: cannot find symbol
    @IntDef({
     ^
  symbol:   class IntDef
  location: class ResizeMode
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java:75: error: cannot find symbol
    @StringDef({
     ^
  symbol:   class StringDef
  location: class VideoEventEmitter
.../node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java:72: error: cannot find symbol
        shutterView.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
                                       ^
  symbol:   variable ContextCompat
  location: class ExoPlayerView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors

Platform

  • Android ExoPlayer

Environment info

React native info output:

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 34.75 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 16, 23, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 25.0.2, 26.0.2, 27.0.0, 27.0.3, 28.0.3, 29.0.2
      System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.2 => 0.61.2
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7
    react-native-rename: 2.2.2

Library version: 4.4.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

18reactions
olinationscommented, Oct 19, 2019

Not sure if you fixed this yet or not, but here is how I fixed it…

In these 2 files…

…/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java:3: error: package android.support.annotation does not exist import android.support.annotation.StringDef;

…/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ResizeMode.java:3: error: package android.support.annotation does not exist import android.support.annotation.IntDef;

replace android.support with androidx

for this one…

…/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ExoPlayerView.java:5: error: package android.support.v4.content does not exist import android.support.v4.content.ContextCompat;

replace android.support.v4 with androidx.core

3reactions
lumbermancommented, Aug 20, 2020

react-native do jetify for you (convert old android modules to new format) when building directly you need to add $> npx jetify to solve the problem with module migration

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting builds - Gradle User Manual
When Gradle is unable to communicate with the Gradle daemon process, the build will immediately fail with a message similar to this: $...
Read more >
Gradle Build failed - Stack Overflow
FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:prepareDebugDependencies'. Dependency Error. See ...
Read more >
CommandInvokationFailure: Gradle build failed. - Unity Forum
i just want to put it here this is work for me to that problem Gradle build failed. (if it android)
Read more >
Gradle build command - Tom Gregory
Running the Gradle build command builds your Gradle project, including assembling your application and running tests.
Read more >
Gradle build fails · Issue #604 · broadinstitute/picard - GitHub
Build failed using the source from the 2.5.0-gradle tar.gz file. I googled for similar issue, it seems I have to git clone the...
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