# Build file 'build.gradle' line: 12, error: Could not find method compile() for arguments [com.example:lib:1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

- **ID:** `java/gradle-build-script-error`
- **Domain:** java
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The 'compile' configuration is deprecated since Gradle 4.0 and removed in Gradle 7.0; use 'implementation' instead.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7+ | active | — | — |

## Workarounds

1. **Replace compile with implementation** (95% success)
   ```
   dependencies { implementation 'com.example:lib:1.0' }
   ```
2. **Use api if the dependency needs to be exposed transitively** (90% success)
   ```
   dependencies { api 'com.example:lib:1.0' }
   ```

## Dead Ends

- **Reverting to an older Gradle version** — This is a temporary fix and prevents using newer features or plugins. (60% fail)
- **Using compileOnly as a direct replacement** — compileOnly does not include the dependency in the runtime classpath, which may cause NoClassDefFoundError. (80% fail)
