我的图片库:序言中不允许包含内容

时间:2019-08-19 21:59:25

标签: android android-studio kotlin

我尝试添加新的实现,以查看是否可以绕过此问题来构建gradle,但是它一直不起作用,只是一直告诉我这个问题。

[Fatal Error] core-1.0.0.pom:2:1: Content is not allowed in prolog.
[Fatal Error] vectordrawable-1.0.0.pom:2:1: Content is not allowed in prolog.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all task dependencies for configuration ':app:kapt'.
   > Could not resolve androidx.core:core:1.0.0.
     Required by:
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.loader:loader:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.customview:customview:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.viewpager:viewpager:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.coordinatorlayout:coordinatorlayout:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.drawerlayout:drawerlayout:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.slidingpanelayout:slidingpanelayout:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
      > Could not resolve androidx.core:core:1.0.0.
         > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/core/core/1.0.0/core-1.0.0.pom
            > Content is not allowed in prolog.
   > Could not resolve androidx.vectordrawable:vectordrawable:1.0.0.
     Required by:
         project :app > com.github.bumptech.glide:glide:4.9.0 > androidx.vectordrawable:vectordrawable-animated:1.0.0
      > Could not resolve androidx.vectordrawable:vectordrawable:1.0.0.
         > Could not parse POM https://dl.google.com/dl/android/maven2/androidx/vectordrawable/vectordrawable/1.0.0/vectordrawable-1.0.0.pom
            > Content is not allowed in prolog.

该模块的Gradle Build

Gradle build

清单

错误的屏幕截图

我用Kotlin

Implemented BlackSamurai advice, managed to get this in the end, I don't know if it works though, I will try it now

所以我设法使构建成功构建,我运行了模拟器以查看我的图片库是否正常工作,并且我明白了:

I think my images are hiding in the corner

1 个答案:

答案 0 :(得分:0)

您似乎在其中一个文件中具有传递依赖。您需要强制使用android.core.1.0.0

implementation('androidx.core:core:1.0.0') {
    force = true
}

您可能还需要对vectorDrawable做同样的事情:

    implementation('androidx.vectordrawable:vectordrawable:1.0.0') {
        force = true
    }

您还应该在清单中添加<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>