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 failing with RN 0.72 #1022

Closed
fabioh8010 opened this issue May 10, 2023 · 6 comments
Closed

[Android] Build failing with RN 0.72 #1022

fabioh8010 opened this issue May 10, 2023 · 6 comments

Comments

@fabioh8010
Copy link

Description

Android build is failing with a project that uses RN 0.72:

FAILURE: Build failed with an exception.

* Where:
Script '/Users/fabiohenriques/Documents/Work/OSS/ReactNative/RN0720RC1/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle' line: 108

* What went wrong:
A problem occurred configuring project ':lottie-react-native'.
> Could not set unknown property 'classifier' for task ':lottie-react-native:androidJavadocsJar' of type org.gradle.api.tasks.bundling.Jar.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
error Failed to install the app. Command failed with exit code 1: ./gradlew tasks FAILURE: Build failed with an exception. * Where:
Script '/Users/fabiohenriques/Documents/Work/OSS/ReactNative/RN0720RC1/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle' line: 108 * What went wrong:
A problem occurred configuring project ':lottie-react-native'.
> Could not set unknown property 'classifier' for task ':lottie-react-native:androidJavadocsJar' of type org.gradle.api.tasks.bundling.Jar. * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s
> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
> Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE > Configure project :lottie-react-native
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
5 actionable tasks: 5 up-to-date.

Applying this patch on src/android/gradle-maven-push.gradle file will solve the problem:

diff --git a/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle b/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle
index 6c97bcf..166e73b 100644
--- a/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle
+++ b/node_modules/lottie-react-native/src/android/gradle-maven-push.gradle
@@ -105,12 +105,12 @@ afterEvaluate { project ->
   }
 
   task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
-    classifier = 'javadoc'
+    archiveClassifier = 'javadoc'
     from androidJavadocs.destinationDir
   }
 
   task androidSourcesJar(type: Jar) {
-    classifier = 'sources'
+    archiveClassifier = 'sources'
     from android.sourceSets.main.java.sourceFiles
   }
 

The building is failing because now RN 0.72 uses Gradle 8.0, and there is breaking change where classifier was removed and archiveClassifier must be used instead.

I tried to fix the problem by myself and raise a PR but wasn't able to find this file in the repo, which makes me wondering if it's something generated during a release.

Steps to Reproduce

  1. Setup a RN project with the 0.72 release candidate.
  2. Add lottie-react-native library to project.
  3. Run the Android build.

Expected behavior: The project should build without problems.

Actual behavior: The project is failing during build.

Versions

"lottie-react-native": "^5.1.5",
"react": "18.2.0",
"react-native": "0.72.0-rc.1"
@matinzd
Copy link
Collaborator

matinzd commented May 14, 2023

gradle-maven-push.gradle file is removed and it will not be available in the next major release. I will try to apply this patch for v5.

matinzd added a commit that referenced this issue May 14, 2023
The building is failing because now RN 0.72 uses Gradle 8.0, and there is breaking change where classifier was removed and archiveClassifier must be used instead.

Gradle push maven is not needed anymore in the RN project

Reference: #1022
@matinzd
Copy link
Collaborator

matinzd commented May 14, 2023

Backported the fix in release v5.1.6.

@matinzd matinzd closed this as completed May 14, 2023
renovate bot added a commit to valora-inc/wallet that referenced this issue Jun 1, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[lottie-react-native](https://togithub.com/airbnb/lottie-react-native#readme)
([source](https://togithub.com/react-native-community/lottie-react-native))
| [`^5.1.5` ->
`^5.1.6`](https://renovatebot.com/diffs/npm/lottie-react-native/5.1.5/5.1.6)
|
[![age](https://badges.renovateapi.com/packages/npm/lottie-react-native/5.1.6/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/lottie-react-native/5.1.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/lottie-react-native/5.1.6/compatibility-slim/5.1.5)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/lottie-react-native/5.1.6/confidence-slim/5.1.5)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>react-native-community/lottie-react-native</summary>

###
[`v5.1.6`](https://togithub.com/lottie-react-native/lottie-react-native/releases/tag/v5.1.6)

[Compare
Source](https://togithub.com/react-native-community/lottie-react-native/compare/v5.1.5...v5.1.6)

#### What's Changed

- fix: breaking change for RN 0.72 and remove gradle-maven-push task in
commit
[f1e5466](https://togithub.com/lottie-react-native/lottie-react-native/commit/f1e54660f3bc4dbe39bd9b4b8b0f8f2314820767)

Fixes:
[lottie-react-native/lottie-react-native#1022

**Full Changelog**:
lottie-react-native/lottie-react-native@v5.1.5...v5.1.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMDIuMTAiLCJ1cGRhdGVkSW5WZXIiOiIzNS4xMDUuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
@rililive
Copy link

Can this also be backported for v4.1.3?

@matinzd
Copy link
Collaborator

matinzd commented Aug 24, 2023

Can this also be backported for v4.1.3?

Is there any reason for you to keep using the old version?
We are not going to support v4 anymore.

@Kamal2301
Copy link

Thank You

@TassainRasool
Copy link

"react-native": "0.68.5",
"react-native-reanimated": "3.6.1",

getting this error
Caused by: groovy.lang.MissingPropertyException: Could not set unknown property 'classifier' for task ':lottie-react-native:androidJavadocsJar' of type org.gradle.api.tasks.bundling.Jar.

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

No branches or pull requests

5 participants