运行模拟器时遇':app:debugAnnotationProcessorClasspath'依赖解析失败求助
Hey there, I’ve run into this exact dependency snag before when working with older ButterKnife versions. Let’s walk through the most reliable fixes to get your project building and running on the simulator again:
1. Make Sure Google Maven Repository is Enabled
The com.google.auto:auto-common dependency lives in Google’s Maven repository, so you need to confirm your project is configured to pull from it. Open your root project’s build.gradle file and check that the repositories block includes google():
// Root build.gradle allprojects { repositories { google() // This is essential for accessing Google-hosted dependencies mavenCentral() // Add any other repositories your project relies on (e.g., jcenter if still needed) } }
Older projects might only have mavenCentral() or jcenter(), but google() is non-negotiable here for this specific dependency.
2. Clear Gradle Cache and Resync
Corrupted or outdated Gradle cache files often cause resolution failures. Try these steps:
- In Android Studio, go to
File > Invalidate Caches..., check the Invalidate and Restart box, and let the IDE reload completely. - Alternatively, manually delete the
.gradlefolder in your project root and thebuildfolder inside yourappmodule, then run this command in your terminal:./gradlew clean build
3. Explicitly Declare the Auto-Common Dependency
If the dependency still won’t resolve through ButterKnife’s transitive pull, force it by adding it directly to your app module’s build.gradle:
// App module build.gradle dependencies { // Keep your existing ButterKnife declarations implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' // Add this line to explicitly fetch the required auto-common version annotationProcessor 'com.google.auto:auto-common:0.8' }
This tells Gradle to grab the exact version you need, skipping any potential transitive resolution glitches.
4. Check Network Access
Sometimes the issue is simply a network block stopping Gradle from downloading dependencies. Confirm your internet connection is stable, and if you’re behind a corporate firewall or proxy, double-check that your Android Studio proxy settings are configured to access Maven repositories properly.
内容的提问来源于stack exchange,提问作者xinaxek

