Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥Can't compile after upgrading to 5.0 #1688

Closed
wmonecke opened this issue Jul 27, 2019 · 16 comments
Closed

🔥Can't compile after upgrading to 5.0 #1688

wmonecke opened this issue Jul 27, 2019 · 16 comments
Labels
stale Closed due to inactivity or lack or resources

Comments

@wmonecke
Copy link

wmonecke commented Jul 27, 2019

Bug

After having updated to 5.0 to migrate to AndroidX I am getting the following error:

> Task :react-native-video:compileReleaseJavaWithJavac FAILED
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/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;
                                 ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/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;
                                 ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/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;
                                 ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/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
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/VideoEventEmitter.java:74: error: cannot find symbol
    @StringDef({
     ^
  symbol:   class StringDef
  location: class VideoEventEmitter
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/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

React native info output:

 System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 4.45 GB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 8.9.4 - /usr/local/bin/node
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 26.0.2, 26.0.3, 27.0.2, 27.0.3, 28.0.2, 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom, android-P | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

MainApplication.java

package com.moodpixel;

import android.app.Application;
import android.util.Log;
import android.support.multidex.MultiDexApplication;

import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;

import com.horcrux.svg.SvgPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.react.ReactPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactApplication;
import com.brentvatne.react.ReactVideoPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.github.reactnativecommunity.location.RNLocationPackage;
import com.arttitude360.reactnative.rngoogleplaces.RNGooglePlacesPackage;

// react-native-firebase
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.admob.RNFirebaseAdMobPackage;
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;

import com.rnfs.RNFSPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.oblador.vectoricons.VectorIconsPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import co.apptailor.googlesignin.RNGoogleSigninPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.babisoft.ReactNativeLocalization.ReactNativeLocalizationPackage;

import java.util.List;

public class MainApplication extends MultiDexApplication implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      packages.add(
        new SvgPackage(),
        new RNFSPackage(),
        new RNDeviceInfo(),
        new PickerPackage(),
        new RNLocationPackage(),
        new ReactVideoPackage(),
        new RNFirebasePackage(),
        new RNFetchBlobPackage(),
        new VectorIconsPackage(),
        new RNGooglePlacesPackage(),
        new RNFirebaseAuthPackage(),
        new LinearGradientPackage(),
        new RNGoogleSigninPackage(),
        new RNFirebaseAdMobPackage(),
        new SplashScreenReactPackage(),
        new RNFirebaseFirestorePackage(),
        new RNFirebaseMessagingPackage(),
        new RNFirebaseNotificationsPackage(),
        new ReactNativeLocalizationPackage()
      );
      return packages;
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    AppEventsLogger.activateApp(this);
    SoLoader.init(this, /* native exopackage */ false);
  }
}

Library version: 5.0

@wmonecke wmonecke changed the title Can't compile after upgrading to 5.0 🔥Can't compile after upgrading to 5.0 Jul 27, 2019
@vokhuyetOz
Copy link

which react native version are you using ?
please check readme again to migrate to AndroidX

@CHaNGeTe
Copy link
Contributor

mmm I think it can be my fault, seems a bad merge from my part, let me check.
As I also merged #1629 seems changes for AndroidX have been overriden, I will check

@CHaNGeTe
Copy link
Contributor

CHaNGeTe commented Jul 28, 2019

@wmonecke @vokhuyetOz Can you check this PR?
#1690

Sorry for the inconveniences (bad idea to make a release from mobile)

@wmonecke
Copy link
Author

@CHaNGeTe Great! When will it be merged?

@CHaNGeTe
Copy link
Contributor

As soon as I can, as 5.0.0 is totally broken.
Did you have the chance to test it?

@CHaNGeTe
Copy link
Contributor

Any news? For me it is working, but I want to be double sure

@vokhuyetOz
Copy link

@CHaNGeTe , it is also working for me

@Jit-Patel
Copy link

Simulator Screen Shot - iPhone XR - 2019-08-05 at 22 41 42

I tried each and every solutions from all community but still same error with version 5.0.0 and 4.4.4 and 4.0.0 .
Please suggestions...?

@ShivangiGheewala
Copy link

Following steps helped to recover from above issue:

  1. Install npm react-native-video package
  2. Link package using react-native link react-native-video
  3. Go to YourReactNativeProject/ios folder in terminal then run 'pod install' command, followed by 'pod update' command (This will link libreact-native-youtube.a (library) to Pods/Products folder. You can check in Xcode)
  4. Re-run your project with react-native run-ios

@Jit-Patel
Copy link

@ShivangiModi6220 It's worked...!!!!!
Thanks a lot ...!

@Jit-Patel
Copy link

Following steps helped to recover from above issue:

  1. Install npm react-native-video package
  2. Link package using react-native link react-native-video
  3. Go to YourReactNativeProject/ios folder in terminal then run 'pod install' command, followed by 'pod update' command (This will link libreact-native-youtube.a (library) to Pods/Products folder. You can check in Xcode)
  4. Re-run your project with react-native run-ios

@ShivangiModi6220
It's worked...!!!!!
Thanks a lot ...!

@Jit-Patel
Copy link

As soon as I can, as 5.0.0 is totally broken.
Did you have the chance to test it?

@CHaNGeTe I tested and is working perfectly fine.

@lumberman
Copy link

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

@gabriel-tentaculo
Copy link

One of those two (or both) worked for me
react-native link react-native-video
and
npx jetify

Just a reminder to people, use the --scan flag when building your project, it helped me to get more insights into what was the problem and find this issue to help me fix my problem

@DragonQi
Copy link

On one of the projects, I fixed it like this, and added to the readme, hope helped

Build failed

Task :react-native-video:compileReleaseJavaWithJavac 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;
^


### Fix problem
.../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`

.../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`

@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue.

@stale stale bot added the stale Closed due to inactivity or lack or resources label Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

No branches or pull requests

9 participants