Android: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath':


我按照ExoPlayer的github指引添加

implementation 'com.google.android.exoplayer:exoplayer:2.X.X'

發現根本run不起來,並報錯如題

后來在stackoverflow找到了解決方案,來源為:https://stackoverflow.com/questions/46949622/android-studio-3-0-unable-to-resolve-dependency-for-appdexoptions-compileclas
出現問題的原因在於app含有buildtype但是library的依賴沒有,所以我們需要添加一個matching configuration fallbacks

  buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        dexOptions {

            // release & debug is in project animators
            matchingFallbacks = ['release', 'debug']
        }
        debug {

        }
    }

在dexOptions下增加callback即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM