未找到资源android:attr/android:progressBarStyle

未找到资源android:attr/android:progressBarStyle,android,android-xml,android-styles,android-progressbar,Android,Android Xml,Android Styles,Android Progressbar,我在将Android Studio更新到最新版本后尝试构建项目时遇到了这个错误。我得到以下错误: C:\Users\YaCn.gradle\caches\transforms-2\files-2.1\5502C0022567BDCF063E0FB4352B137\folioreReader-0.3.3\res\layout\progress\u dialog.xml:10: AAPT:错误:未找到资源android:attr/android:progressBarStyle 该XML: <

我在将Android Studio更新到最新版本后尝试构建项目时遇到了这个错误。我得到以下错误:

C:\Users\YaCn.gradle\caches\transforms-2\files-2.1\5502C0022567BDCF063E0FB4352B137\folioreReader-0.3.3\res\layout\progress\u dialog.xml:10: AAPT:错误:未找到资源android:attr/android:progressBarStyle

该XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:id="@+id/layout_loading"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:gravity="center">
        <ProgressBar android:id="@+id/loading"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="?android:attr/android:progressBarStyle"/>
        <TextView android:id="@+id/label_loading"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:textSize="18sp"
            android:textColor="@android:color/white"
            android:text="@string/loading"/>
    </LinearLayout>
</RelativeLayout>

您使用了错误的syles。只需将您的样式更改为:

style="?android:attr/progressBarStyle"
而不是

style="?android:attr/android:progressBarStyle"

尝试将此添加到您的依赖项中

implementation "com.folioreader:folioreader:0.5.4"//this is just the updated version as of now
implementation 'com.android.support:multidex:1.0.3' // ( for androidx)
configurations.matching { it.name == '_internal_aapt2_binary' }.all {
    config -> config.resolutionStrategy.eachDependency {
        details -> details.useVersion("3.3.2-5309881")
    } 
}

在layout中创建一个新文件,将其命名为progress_dialog.xml并粘贴此代码

<LinearLayout android:id="@+id/layout_loading"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <ProgressBar
        android:id="@+id/loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="?android:attr/progressBarStyle" />

    <TextView
        android:id="@+id/label_loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:textSize="18sp"
        android:textColor="@android:color/white"
        android:text="@string/loading" />
</LinearLayout>


您能补充一下为什么这样可以解决问题吗?我不确定这个解释,但我想在layout中添加这个文件会取代library progress\u dialog.xml中的文件
<LinearLayout android:id="@+id/layout_loading"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <ProgressBar
        android:id="@+id/loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="?android:attr/progressBarStyle" />

    <TextView
        android:id="@+id/label_loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:textSize="18sp"
        android:textColor="@android:color/white"
        android:text="@string/loading" />
</LinearLayout>