element-hq / element-hq/element-x-android
Gradle build fails: "Invalid catalog definition – 'from' method called more than once
- Dominant language
- Kotlin
- Stars
- 2.4k
- Forks
- 624
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 149
Description
---
I’m encountering a build failure when trying to clean and rebuild the project. The issue seems related to Gradle version catalog configuration.
---
**Steps to Reproduce**
1. Navigate to project directory:
```bash
cd element-x-android
```
2. Run:
```bash
./gradlew --stop
rm -rf .gradle
rm -rf ~/.gradle/caches
./gradlew clean
```
---
**Expected Behavior**
The project should clean and build successfully.
---
**Actual Behavior**
The build fails with the following error:
```
Invalid catalog definition:
- Problem: In version catalog libs, you can only call the 'from' method a single time.
Reason: The method was called more than once.
Possible solution: Remove further usages of the method call.
```
---
**Environment**
* OS: Ubuntu (Linux)
* Gradle Version: (please fill, e.g. 8.x)
* Project: element-x-android
* Java Version: (please fill, e.g. 17)
---
**Additional Context**
* The issue persists even after clearing Gradle caches.
* Happens during initial configuration phase (before compilation).
* Likely related to `libs.versions.toml` or `settings.gradle(.kts)` configuration where `versionCatalogs {}` is defined.
---
**Possible Cause (Guess)**
There might be multiple `from(...)` calls inside the `versionCatalogs` block, which Gradle does not allow.
---
**Request**
Could you please confirm:
* Where the duplicate `from(...)` invocation might be coming from?
* If this is a known issue with current project setup or Gradle version compatibility?
---
**Logs (excerpt)**
```
FAILURE: Build failed with an exception.
* What went wrong:
Invalid catalog definition:
- Problem: In version catalog libs, you can only call the 'from' method a single time.
```
---
**References**
* [https://docs.gradle.org/current/userguide/version_catalog_problems.html#too_many_import_invocation](https://docs.gradle.org/current/userguide/version_catalog_problems.html#too_many_import_invocation)
Contributor guide
Assessment
This issue has not been assessed yet.