添加learncoding模块依赖时出现':app@debug/compileClasspath'依赖解析错误求助
Let's walk through the most likely fixes for this issue—dependency resolution errors usually boil down to simple configuration oversights:
1. Fix the Module Name Typo
First, look at the error message: it's complaining about :learncodings, but your module's configuration shows it's named learncoding (note the missing trailing "s"). In your app module's build.gradle, change the dependency line from:
implementation project(':learncodings')
to:
implementation project(':learncoding')
This is the most common cause of this exact error—Gradle can't find a module that doesn't exist because of a typo.
2. Ensure the Module is Registered in settings.gradle
Head to your project's root settings.gradle file and make sure it explicitly includes the learncoding module. It should look something like this:
include ':app', ':learncoding'
If the :learncoding entry is missing, add it, then click the "Sync Project with Gradle Files" button (the elephant icon) in Android Studio.
3. Clean and Rebuild Your Project
Sometimes cached build files can cause weird dependency issues. Run these steps in order:
- Click
Build > Clean Project - Click
Build > Rebuild Project - Sync Gradle again using the elephant icon
This clears out any stale build artifacts that might be confusing Gradle.
4. Quick Compatibility Check (Optional)
While your two modules have matching compileSdkVersion and buildToolsVersion, double-check that your root project's build.gradle uses a Gradle plugin version compatible with buildToolsVersion 26.0.2. For example:
// Root build.gradle buildscript { dependencies { classpath 'com.android.tools.build:gradle:2.3.3' // Compatible with buildTools 26.x } }
This is less likely to be the issue here, but it's worth verifying if the above steps don't resolve the error.
Quick Side Note
You're mixing deprecated compile dependencies with the newer implementation syntax in your app module. While this won't break your build, it's best to switch all compile entries to implementation to align with modern Gradle practices.
内容的提问来源于stack exchange,提问作者dinesh

