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



当我将Android Studio更新到最新版本后尝试构建我的项目时,我遇到了此错误。我得到以下错误:

C:\Users\YaCn.gradle\caches\transforms-2\files-2.1\5502c0022567bdcff063e0fb4352b137\folioreader-0.3.3\res\layout\progress_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>

构建 gradle 文件 :

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.admin.hashtab"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
onesignal_app_id               : "654bcb8c-90a6-4012-924a-e18e5787a7de",
onesignal_google_project_number: "3520309722"]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-analytics:12.0.1'
implementation 'com.onesignal:OneSignal:3.+@aar'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.github.ornolfr:rating-view:0.1.2@aar'
implementation project(path: ':library')
implementation project(path: ':SmoothCheckBox-master')
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.folioreader:folioreader:0.3.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.lmntrx.android.library.livin.missme:missme:0.1.5'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

尝试将其添加到依赖项中

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")
} 
}

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

style="?android:attr/progressBarStyle"

而不是

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

在布局中创建一个新文件,将其命名为 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>