progressBarStyle not working on Android Studio

Viewed 536

I have a problem with Android Studio.

Task :app:processDebugResources FAILED AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/luisabsg/.gradle/caches/transforms-2/files-2.1/270e51d2bcfda0833b0b336f50197a8a/jetified-folioreader-0.5.4/res/layout/progress_dialog.xml","position":{"startLine":16}}],"original":"ERROR:/Users/luisabsg/.gradle/caches/transforms-2/files-2.1/270e51d2bcfda0833b0b336f50197a8a/jetified-folioreader-0.5.4/res/layout/progress_dialog.xml:17: AAPT: error: resource android:attr/android:progressBarStyle not found.\n ","tool":"AAPT"}

Execution failed for task ':app:processDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed ERROR:/Users/luisabsg/.gradle/caches/transforms-2/files-2.1/270e51d2bcfda0833b0b336f50197a8a/jetified-folioreader-0.5.4/res/layout/progress_dialog.xml:17: AAPT: error: resource android:attr/android:progressBarStyle not found.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

enter image description here

2 Answers
AAPT: error: resource android:attr/android:progressBarStyle not found.

You set the style of the progress bar to R.style.Widget_ProgressBar_Horizontal . Finally

style="@android:style/Widget.ProgressBar.Horizontal"

OR

 style="?android:attr/progressBarStyleHorizontal"

FYI

Android resource linking failed ERROR:/Users/luisabsg/.gradle/caches/transforms-2/files-2.1/270e51d2bcfda0833b0b336f50197a8a/jetified-folioreader-0.5.4/res/layout/progress_dialog.xml:17

In your project app module Goto :- Your-Project-Location -> /app/src/main/res/layout/ and create file progress_dialog.xml and set below code :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:id="@+id/layout_loading"
        android:layout_width="match_parent"
        android:layout_height="match_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/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>

You are using wrong styling attribute, you should use style="?android:attr/progressBarStyle" in your progress style.

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