Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve 问题解决

After trying a lot, involving many solutions on Baidu, I finally found the solution: see the difference. . . .
 

//这里是app里面的配置
buildTypes {
        debug {
              debuggable true
                ....
        }
        sdk {
                debuggable true
                minifyEnabled true
                shrinkResources false
                zipAlignEnabled true
                ....
        }
        release {
              minifyEnabled false
                ....
        }
    }
  • /**
     * 这里是library的bulide.gradle配置
     */
     buildTypes {
          
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                'proguard-rules.pro'
            }
    
        }

    Find the difference? Modify the build.gradle of the library and refer to the build.gradle in the app. For example (empty is also acceptable):

  • /**
     * bulide.gradle的配置
     */
     buildTypes {
           debug {
    
            }
            sdk {
    
            }
          
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                'proguard-rules.pro'
            }
    
        }

    Sync Now Recompile, solved.

Guess you like

Origin blog.csdn.net/zyy_give/article/details/89954532