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

我按照ExoPlayer的github指引添加android

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

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

後來在stackoverflow找到了解決方案,來源爲:https://stackoverflow.com/questions/46949622/android-studio-3-0-unable-to-resolve-dependency-for-appdexoptions-compileclas
出現問題的緣由在於app含有buildtype可是library的依賴沒有,因此咱們須要添加一個matching configuration fallbacksgithub

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便可android-studio

相關文章
相關標籤/搜索