首页 > 解决方案 > 未找到样式属性“android:attr/attr/gravity”,

问题描述

我对 android studio 系统进行了更新,但无法为我的项目构建错误指示系统文件“values.xml”。

我已经看到了很多答案,但所有答案都包括文件更改操作,我无法更改它,因为它每次都会从某个地方填满。有什么帮助吗?

下面是我的values.xml系统文件:

   <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <attr format="reference" name="SquareTextView"/>
        <declare-styleable name="SquareTextView"><attr format="dimension" name="minTextSize"/></declare-styleable>
        <dimen name="album_thum_size">70dp</dimen>
        <string name="album">Album</string>
        <string name="camera">camera</string>
        <string name="done">done</string>
        <string name="msg_full_image">You can\'t no longer choose.</string>
        <string name="msg_no_image">There is no image.</string>
        <string name="msg_no_slected">There is no selected image.</string>
        <string name="msg_permisssion">permission deny</string>
        <string name="str_all_view">All view</string>
        <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
        <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
        <style name="SquareTextView">
            <!-- some graphical improvements just for the demo. feel free to remove -->
            <!--<item name="@android:attr/padding">5dp</item>-->
            <item name="@android:attr/gravity">center</item>

            <!-- use the next line to alter the minimum text size (uncomment first)-->
             <item name="@attr/minTextSize">5dp</item>
        </style>
    </resources>

这是我的错误:

C:\Users*MY_USER*.gradle\caches\transforms-2\files-2.1\eded8b13b43fea070a7476e315407686\FishBun-0.4.4\res\values\values.xml:16:5-23:13:AAPT:错误:样式属性'android:attr/attr/gravity' 未找到。

标签: androidxmlandroid-studio

解决方案


我认为您正在使用FishBun
如果是这样,您需要在更新 Android Studio 后升级它
在您的应用程序 build.gradle 文件中更新 FishBun 库实现,如下所示

// Under the Android Plugin 3.0.0. 
compile 'com.sangcomz:FishBun:1.0.0-alpha02'

compile 'com.squareup.picasso:picasso:2.71828'
compile 'io.coil-kt:coil:0.11.0'
or
compile 'com.github.bumptech.glide:glide:4.9.0'
        
// Android plugin 3.0.0 or higher.
implementation 'com.sangcomz:FishBun:1.0.0-alpha03'

implementation 'io.coil-kt:coil:0.11.0'
or
implementation 'com.github.bumptech.glide:glide:4.11.0'

并查看 FishBun文档以了解新用途。


推荐阅读