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

Failed to find byte code for com/google/firebase [any unused module] #915

Closed
xzilja opened this issue Mar 27, 2018 · 22 comments
Closed

Failed to find byte code for com/google/firebase [any unused module] #915

xzilja opened this issue Mar 27, 2018 · 22 comments
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Build Error Behaviour causing build failure Platform: Android

Comments

@xzilja
Copy link
Contributor

xzilja commented Mar 27, 2018

Issue

I upgraded to android studio 3.1 today and gradle 3.1 that came out and started getting these errors

Failed to find byte code for com/google/android/gms/ads/VideoController$VideoLifecycleCallbacks

Failed to find byte code for com/google/firebase/storage/StreamDownloadTask$StreamProcessor

Failed to find byte code for com/google/firebase/database/ChildEventListener

etc... all of these are firebase modules I currently don't use in my project i.e I don't have anything like

compile 'com.google.firebase:firebase-database:11.8.0'

in my app/build.gradle as I don't use it. I also submitted a question at stack overflow regarding this: https://stackoverflow.com/questions/49518556/failed-to-find-byte-code-for-com-google-firebase

Where they suggested to actually include any erorring modules and this does indeed fix the issue, but I had to add a ton of them, which I don't think is necessary?

Fact that this happens to almost all firebase dependencies that I don't use and can only assume are used in RNFirebase I think this is an issue?

Environment

  1. Application Target Platform: Android
  1. Development Operating System: macOS High Siera
  1. Build Tools: Android Studio 3.1, Android SDK 26, com.android.tools.build:gradle:3.1.0
  1. React Native version: 0.54.3
  1. RNFirebase Version: 3.3.1
  1. Firebase Module: Any unused module
@Salakar Salakar added Platform: Android Impact: Build Error Behaviour causing build failure Help: Needs Triage Issue needs additional investigation/triaging. labels Mar 28, 2018
@chrisbianca
Copy link
Contributor

@iljadaderko any chance you could try the latest code from master and see whether its fixed? Just did some changes to migrate to the new Gradle dependency configurations: 7f7169b

Alternatively, try making the equivalent changes locally to see if it fixes the issue...

@xzilja
Copy link
Contributor Author

xzilja commented Mar 28, 2018

@chrisbianca will give it a shot as soon as I am done with my main work. Could be related to compile being deprecated.

When we include firebase modules in our own projects, I assume we should use implementation instead of compile?

@chrisbianca
Copy link
Contributor

Great, thanks. Yeah, I've switched our tests app over to using implementation and this seems to work. Although I couldn't actually reproduce the errors you were seeing to be able to confirm it's fixed your problem.

@xzilja
Copy link
Contributor Author

xzilja commented Mar 28, 2018

There was one other guy in Stack Overflow question I mentioned having same issues with 3.3 after upgrading to latest gradle by the way.

@xzilja
Copy link
Contributor Author

xzilja commented Mar 28, 2018

@chrisbianca ok, so I basically swapped android/build.gradle in my node_modules with your change and it got past that error 👍

I'm not sure if this is already fixed in v4 but now this is popping up

error: RNFirebaseAdMobRewardedVideo is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener

I'm not using adMob module in project, so not sure if its still related to this issue. Let me know if I should close and open another one.

I will run v4 this weekend to see if it fixes these issues, as there are few things I need to change according to the docs to make it work.

@chrisbianca
Copy link
Contributor

Awesome, thanks for the confirmation!

Yes, that is fixed in v4 - it's a result of some API changes in v12 of the Firebase Android libs

@xzilja
Copy link
Contributor Author

xzilja commented Mar 28, 2018

As a side note, my project has all changes you made to test app as well, so if yours is working on v4, I think mine will as well 👍

@chrisbianca
Copy link
Contributor

We're going to get another RC of v4 out shortly - once we have, we'll close this issue off.

We're unlikely to backport this to v3 due to the complications with getting it working across multiple gradle versions.

@chrisbianca
Copy link
Contributor

v4.0.0-rc.3 is out now.

Check out the release notes for instructions on how to upgrade gradle: https://github.com/invertase/react-native-firebase/releases/tag/v4.0.0-rc.3

@xzilja
Copy link
Contributor Author

xzilja commented Mar 29, 2018

@chrisbianca I updated my project to v4.0.0-rc.3 just now, started getting these errors again.
As this didn't make much sense to me I tired to reset all caches I can think of

  1. Deleted my projects /build, .iml files
  2. Deleted /.gradle folder from my macs home dir
  3. Reinstalled my node modules (deleted them, deleted package-lock, ran npm cache verify)

And am still getting the error

I went and compared build.gradle from rc3 that I have in android studio with changes you referenced 7f7169b, everything is identical.

My next step was to compare my android setup with your test app setup and there is one difference, but nothing I can see that would cause this, I have com.google.gms:google-services:3.2.0 (I tried to use 3.1.2 as in test app to be sure, didn't make a change)

My dependencies are

dependencies {
    implementation fileTree(include: ["*.jar"], dir: "libs")
    implementation "com.android.support:appcompat-v7:27.1.0"
    implementation "com.google.android.gms:play-services-base:12.0.0"
    implementation "com.google.android.gms:play-services-auth:12.0.0"
    implementation "com.google.firebase:firebase-core:12.0.0"
    implementation "com.google.firebase:firebase-auth:12.0.0"
    implementation "com.google.firebase:firebase-firestore:12.0.0"
    implementation "com.google.firebase:firebase-invites:12.0.0"
    implementation "com.google.firebase:firebase-messaging:12.0.0"
    implementation "com.facebook.react:react-native:+"
    implementation project(":react-native-device-info")
    implementation project(":react-native-fbsdk")
    implementation(project(":rn-google-sign-in")){
        exclude group: "com.google.android.gms"
    }
    implementation(project(":react-native-firebase")) {
        transitive = false
    }
}

I am currently getting errors related to database / adMob etc.. all modules I don't use

Failed to find byte code for com/google/firebase/storage/OnPausedListener

@xzilja
Copy link
Contributor Author

xzilja commented Mar 30, 2018

And as expected it all worked once I added (not propper solution however, correct?)

    // Don't need these
    implementation "com.google.firebase:firebase-ads:12.0.1"
    implementation "com.google.firebase:firebase-config:12.0.1"
    implementation "com.google.firebase:firebase-crash:12.0.1"
    implementation "com.google.firebase:firebase-database:12.0.1"
    implementation "com.google.firebase:firebase-perf:12.0.1"
    implementation "com.google.firebase:firebase-storage:12.0.1"
    // END Don't need these

@chrisbianca
Copy link
Contributor

@iljadaderko It looks like this is a known issue in 3.1 :( https://issuetracker.google.com/issues/72811718

If you disable instant run this should start working for you again.

@xzilja
Copy link
Contributor Author

xzilja commented Apr 4, 2018

Gotcha, thank you for bug reference, shame they released with this :/

@chrisbianca
Copy link
Contributor

Isn't it just! Pretty poor tbh, essentially breaking any library that's correctly specifying compileOnly dependencies.

We'll make sure we include it in the upgrade / migration notes. I think if you run from the command line, this won't be an issue, it's only if you go through Android Studio.

@xzilja
Copy link
Contributor Author

xzilja commented Apr 4, 2018

Yeh, it seems its related to their "Instant Run" functionality, that can be disabled. Will make rebuilding apps a bit slower however, might be a good alternative instead of including all missing libs for some people.

@MultidimensionalLife
Copy link

Same issue here. Any fixes for this?

@xzilja
Copy link
Contributor Author

xzilja commented Apr 20, 2018

@sequencer08 3 options

  1. Disable instant run in android studio
  2. Add all firebase modules
  3. Upgrade to gradle 3.1.1

@MultidimensionalLife
Copy link

Hi @iljadaderko, Thanks for the suggestion. I able to fixed the issue by including all the firebase modules since I already upgraded the gradle to 3.1.1. But is there any option except including all firebase modules? For me, I think It's not necessary to include what I'm not using. Big thanks 😄

@xzilja
Copy link
Contributor Author

xzilja commented Apr 20, 2018

@sequencer08 honestly I'd just disable instant run in android studio, its not needed for react native projects imho. Googling how to do so should solve your issue 👍 Its android studio specific, when you build with cli you won't see the issue.

@zkrige
Copy link

zkrige commented Jun 11, 2018

Disabling instant run fixed this

@EKoetsjarjan
Copy link

Failed to find byte code for com/google/firebase/database/DatabaseReference$CompletionListener

disabling instant run fixed it for for me too (android studio 3.2.1)

@artyom-developer
Copy link

same bugs :( help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Build Error Behaviour causing build failure Platform: Android
Projects
None yet
Development

No branches or pull requests

7 participants