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

Android build fails with com.facebook.infer.annotation.Assertions not found on latest Expo SDK 31.0.0 & React Native 0.57 #342

Open
webdevbyjoss opened this issue Dec 14, 2018 · 3 comments · May be fixed by #343

Comments

@webdevbyjoss
Copy link

webdevbyjoss commented Dec 14, 2018

Build failure

Trying to build the Android app after detaching on latest Expo SDK 31.0.0 & React Native 0.57.

Build fails with the following:

/home/travis/build/-------/node_modules/react-native-youtube/android/src/main/java/com/inprogress/reactnativeyoutube/YouTubeManager.java:5: error: package com.facebook.infer.annotation does not exist

import com.facebook.infer.annotation.Assertions;
                                    ^
/home/travis/build/-------/node_modules/react-native-youtube/android/src/main/java/com/inprogress/reactnativeyoutube/YouTubeManager.java:49: error: cannot find symbol
        Assertions.assertNotNull(view);
        ^
  symbol:   variable Assertions
  location: class YouTubeManager
/home/travis/build/-------/node_modules/react-native-youtube/android/src/main/java/com/inprogress/reactnativeyoutube/YouTubeManager.java:50: error: cannot find symbol
        Assertions.assertNotNull(args);
        ^
  symbol:   variable Assertions
  location: class YouTubeManager
Note: /home/travis/build/-------/node_modules/react-native-youtube/android/src/main/java/com/inprogress/reactnativeyoutube/YouTubeStandaloneModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
:react-native-youtube:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-youtube:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

The build was passing successfully on Expo SDK 28.0.0 & React Native 0.55 before the upgrade.

Workaround

Add the explicit infer-annotation dependency to react-native-youtube/android/build.gradle:

dependencies  {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.facebook.react:react-native:+'
    compile 'com.facebook.infer.annotation:infer-annotation:+'    <====== add this line!!!!
}

Build turns green again!

This assertion is actually used only once:
https://github.com/inProgress-team/react-native-youtube/search?q=Assertions&unscoped_q=Assertions

Wondering if we could get rid of this whole library and assertion code to just have:

if (object == null) {
      throw new AssertionError();
}

that's actually what it does under the hood: https://github.com/facebook/infer/blob/master/infer/annotations/src/main/java/com/facebook/infer/annotation/Assertions.java#L24

Would be happy to do a PR for this fix, if you think it all makes sense.

@webdevbyjoss
Copy link
Author

webdevbyjoss commented Dec 14, 2018

Here is the Pull-Request that fixes this: #343 . Tested on my app, it builds and works like a charm 😄

@Martmists-GH
Copy link

Any ETA on when this will get added to the main repo?

@webdevbyjoss
Copy link
Author

webdevbyjoss commented Jun 1, 2020

No feedback from maintainers yet, so not sure when this could be merged. I'd love to get it merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants