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

The following Android dependencies are set to compileOnly which is not supported: com.google.j2objc:j2objc-annotations:2.8 #6232

Open
shyvum opened this issue Sep 5, 2024 · 14 comments

Comments

@shyvum
Copy link

shyvum commented Sep 5, 2024

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Ladybug 2024.2.1 Canary 9
  • Firebase Component: BOM
  • Component version: 33.2.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  • Upgrade BOM to 33.2.0 from 33.1.2.
  • Build will fail saying
The following Android dependencies are set to compileOnly which is not supported:
  -> com.google.j2objc:j2objc-annotations:2.8

Relevant Code:

No code change

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@shyvum
Copy link
Author

shyvum commented Sep 5, 2024

we faced a very similar issue w/ androidx.media3 several weeks back. androidx/media#1325

@lehcar09
Copy link
Contributor

lehcar09 commented Sep 5, 2024

Hi @ShivamGoyal1899, thank you for reaching out. I'm not familiar with the j2objc-annotations dependency. Per checking,
Firebase Android SDK does not use the dependency j2objc-annotations.

This issue means that the Gradle build system used by Android cannot determine how to handle the annotations provided by the j2objc-annotations library within an Android project. If you're not using the latest Android Gradle plugin, I would suggest try using the latest version to see if the issue is already resolved.

To get better help, It would be best to reach out to the j2objc support team. That said, I'll be closing this issue now. Let me know if you have questions or clarifications. Thanks!

@lehcar09 lehcar09 closed this as completed Sep 5, 2024
@shyvum
Copy link
Author

shyvum commented Sep 5, 2024

@lehcar09 we are on latest AGP and Gradle. also the issue does not comes up while using BOM v33.1.2. it fails to compile after bumping BOM to v33.2.0 (no other code change).

@shyvum
Copy link
Author

shyvum commented Sep 19, 2024

@lehcar09 this is still not working on latest BOM. can you please take a look?

@cpovirk
Copy link
Contributor

cpovirk commented Sep 23, 2024

Someone reported this to us on the Guava side in google/guava#7397. I'm working to fix it there. Once I do so, Firebase should be able to upgrade to a new version of Guava, and the problem should go away. Sorry for the trouble.

copybara-service bot pushed a commit to google/guava that referenced this issue Sep 23, 2024
While that artifact contains no runtime-retention annotations, it does contain class-retention annotations (which could drive a runtime bytecode-rewriting agent). And, more practically, the Android Gradle Plugin has started reporting errors for `compileOnly` dependencies.

Addresses #7397. (But I'll keep that issue open until I publish a release.)

Relevant to firebase/firebase-android-sdk#6232 and androidx/media#1700.

RELNOTES=Added `j2objc-annotations` to the Gradle runtime classpath to avoid [an Android Gradle Plugin error](#7397).
PiperOrigin-RevId: 677781422
copybara-service bot pushed a commit to google/guava that referenced this issue Sep 23, 2024
While that artifact contains no runtime-retention annotations, it does contain class-retention annotations (which could drive a runtime bytecode-rewriting agent). And, more practically, the Android Gradle Plugin has started reporting errors for `compileOnly` dependencies.

Fixes #7397

Relevant to firebase/firebase-android-sdk#6232 and androidx/media#1700

RELNOTES=Added `j2objc-annotations` to the Gradle runtime classpath to avoid [an Android Gradle Plugin error](#7397).
PiperOrigin-RevId: 677781422
copybara-service bot pushed a commit to google/guava that referenced this issue Sep 23, 2024
While that artifact contains no runtime-retention annotations, it does contain class-retention annotations (which could drive a runtime bytecode-rewriting agent). And, more practically, the Android Gradle Plugin has started reporting errors for `compileOnly` dependencies.

Fixes #7397

Relevant to firebase/firebase-android-sdk#6232 and androidx/media#1700

RELNOTES=Added `j2objc-annotations` to the Gradle runtime classpath to avoid [an Android Gradle Plugin error](#7397).
PiperOrigin-RevId: 677842769
@cpovirk
Copy link
Contributor

cpovirk commented Sep 24, 2024

I released Guava 33.3.1, which contains what I believe should be a fix. Is expect that users could eliminate the error by declaring an explicit dependency on that version, and Firebase can upgrade to that version so that anyone who then upgrades Firebase will likewise no longer see the problem. Let me know if any of that doesn't work as expected. Sorry again for the problem.

@shyvum
Copy link
Author

shyvum commented Sep 24, 2024

@lehcar09 can you please bump and confirm?

@lehcar09 lehcar09 reopened this Sep 24, 2024
@lehcar09
Copy link
Contributor

Thank you for sharing the insight and fix @cpovirk.

Hi @ShivamGoyal1899, I tried reproducing the issue using the Firebase BOM 33.2.0, however, I did not encounter the issue.

Can you help and see what I'm missing here?

build.gradle.kts

plugins {
    id("com.android.application") version "8.6.1" apply false
    id("com.android.library") version "8.6.1" apply false
    id("org.jetbrains.kotlin.android") version "2.0.10" apply false
    id("com.google.gms.google-services") version "4.4.2" apply false
}

app/build.gradle.kts

    implementation(platform("com.google.firebase:firebase-bom:33.2.0"))
    implementation("com.google.firebase:firebase-analytics")

Alternatively, you can try adding the new Guava dependency explicitly in your app/gradle file to override the current version. Upon Checking the Google Analytics 22.1.0 is using com.google.guava:guava:31.1-android.

dependencies {
  implementation("com.google.guava:guava:33.3.1-android")
}

@google-oss-bot
Copy link
Contributor

Hey @ShivamGoyal1899. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@shyvum
Copy link
Author

shyvum commented Oct 1, 2024

@lehcar09 we currently use all below attached dependencies in our project.

Screenshot 2024-10-01 at 11 56 57 AM

@shyvum
Copy link
Author

shyvum commented Oct 1, 2024

@lehcar09 also, media3 folks did bump to new guava versions and were able to resolve the issue. androidx/media#1700

@lehcar09
Copy link
Contributor

lehcar09 commented Oct 1, 2024

Thank you for additional details you shared. I'm still having trouble issue in reproducing the issue. However, I'll notify our engineers about this to bump the Guava version in our SDK.

Just to note, we cannot provide any timeline on this. As a workaround for now, you can try adding the new Guava 33.3.0 dependency explicitly in your app/gradle file to override the current version.

@shyvum
Copy link
Author

shyvum commented Oct 1, 2024

understood.

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

No branches or pull requests

4 participants