起初,我可以毫无问题地运行所有内容,但后来,每当我试图构建这个xml文件时,突然出现了这个错误:C:\ Users \ Lenovo . grad le \ caches \ transforms-2 \ files-2.1 \ f 243 f 87 f 287 FB 4 f 4052 BD 069 a9b 71980 \ core-1 . 7 . 0 \ RES \ values \ values . XML:105:5..说AAPT:错误:资源android:attr/lStar未找到我甚至尝试创建一个新的空项目,但问题仍然发生在每次我试图运行..那么这个XML文件产生了什么问题呢?
这是我的代码文件:
值.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr format="reference" name="nestedScrollViewStyle"/>
<color name="androidx_core_ripple_material_light">#1f000000</color>
<color name="androidx_core_secondary_text_default_material_light">#8a000000</color>
<color name="notification_action_color_filter">#ffffffff</color>
<color name="notification_icon_bg_color">#ff9e9e9e</color>
<dimen name="compat_button_inset_horizontal_material">4dp</dimen>
<dimen name="compat_button_inset_vertical_material">6dp</dimen>
<dimen name="compat_button_padding_horizontal_material">8dp</dimen>
<dimen name="compat_button_padding_vertical_material">4dp</dimen>
<dimen name="compat_control_corner_material">2dp</dimen>
<dimen name="compat_notification_large_icon_max_height">320dp</dimen>
<dimen name="compat_notification_large_icon_max_width">320dp</dimen>
<dimen name="notification_action_icon_size">32dp</dimen>
<dimen name="notification_action_text_size">13sp</dimen>
<dimen name="notification_big_circle_margin">12dp</dimen>
<dimen name="notification_content_margin_start">8dp</dimen>
<dimen name="notification_large_icon_height">64dp</dimen>
<dimen name="notification_large_icon_width">64dp</dimen>
<dimen name="notification_main_column_padding_top">10dp</dimen>
<dimen name="notification_media_narrow_margin">@dimen/notification_content_margin_start</dimen>
<dimen name="notification_right_icon_size">16dp</dimen>
<dimen name="notification_right_side_padding_top">2dp</dimen>
<dimen name="notification_small_icon_background_padding">3dp</dimen>
<dimen name="notification_small_icon_size_as_large">24dp</dimen>
<dimen name="notification_subtext_size">13sp</dimen>
<dimen name="notification_top_pad">10dp</dimen>
<dimen name="notification_top_pad_large_text">5dp</dimen>
<drawable name="notification_template_icon_bg">#3333B5E5</drawable>
<drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
<item name="accessibility_action_clickable_span" type="id"/>
<item name="accessibility_custom_action_0" type="id"/>
<item name="accessibility_custom_action_1" type="id"/>
<item name="accessibility_custom_action_10" type="id"/>
<item name="accessibility_custom_action_11" type="id"/>
<item name="accessibility_custom_action_12" type="id"/>
<item name="accessibility_custom_action_13" type="id"/>
<item name="accessibility_custom_action_14" type="id"/>
<item name="accessibility_custom_action_15" type="id"/>
<item name="accessibility_custom_action_16" type="id"/>
<item name="accessibility_custom_action_17" type="id"/>
<item name="accessibility_custom_action_18" type="id"/>
<item name="accessibility_custom_action_19" type="id"/>
<item name="accessibility_custom_action_2" type="id"/>
<item name="accessibility_custom_action_20" type="id"/>
<item name="accessibility_custom_action_21" type="id"/>
<item name="accessibility_custom_action_22" type="id"/>
<item name="accessibility_custom_action_23" type="id"/>
<item name="accessibility_custom_action_24" type="id"/>
<item name="accessibility_custom_action_25" type="id"/>
<item name="accessibility_custom_action_26" type="id"/>
<item name="accessibility_custom_action_27" type="id"/>
<item name="accessibility_custom_action_28" type="id"/>
<item name="accessibility_custom_action_29" type="id"/>
<item name="accessibility_custom_action_3" type="id"/>
<item name="accessibility_custom_action_30" type="id"/>
<item name="accessibility_custom_action_31" type="id"/>
<item name="accessibility_custom_action_4" type="id"/>
<item name="accessibility_custom_action_5" type="id"/>
<item name="accessibility_custom_action_6" type="id"/>
<item name="accessibility_custom_action_7" type="id"/>
<item name="accessibility_custom_action_8" type="id"/>
<item name="accessibility_custom_action_9" type="id"/>
<item name="line1" type="id"/>
<item name="line3" type="id"/>
<item name="tag_accessibility_actions" type="id"/>
<item name="tag_accessibility_clickable_spans" type="id"/>
<item name="tag_accessibility_heading" type="id"/>
<item name="tag_accessibility_pane_title" type="id"/>
<item name="tag_on_apply_window_listener" type="id"/>
<item name="tag_on_receive_content_listener" type="id"/>
<item name="tag_on_receive_content_mime_types" type="id"/>
<item name="tag_screen_reader_focusable" type="id"/>
<item name="tag_state_description" type="id"/>
<item name="tag_transition_group" type="id"/>
<item name="tag_unhandled_key_event_manager" type="id"/>
<item name="tag_unhandled_key_listeners" type="id"/>
<item name="tag_window_insets_animation_callback" type="id"/>
<item name="text" type="id"/>
<item name="text2" type="id"/>
<item name="title" type="id"/>
<integer name="status_bar_notification_info_maxnum">999</integer>
<string name="status_bar_notification_info_overflow">999+</string>
<style name="TextAppearance.Compat.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent"/>
<style name="TextAppearance.Compat.Notification.Info">
<item name="android:textSize">12sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Compat.Notification.Line2" parent="TextAppearance.Compat.Notification.Info"/>
<style name="TextAppearance.Compat.Notification.Time">
<item name="android:textSize">12sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.Compat.Notification.Title" parent="@android:style/TextAppearance.StatusBar.EventContent.Title"/>
<style name="Widget.Compat.NotificationActionContainer" parent=""/>
<style name="Widget.Compat.NotificationActionText" parent=""/>
<declare-styleable name="Capability">
<!-- Resource reference to the string array of query patterns for a custom capability. -->
<attr format="reference" name="queryPatterns"/>
<!-- Indicates whether a parameter in a capability template can only contain a matched
shortcut id and not an arbitrary string. -->
<attr format="boolean" name="shortcutMatchRequired"/>
</declare-styleable>
<declare-styleable name="ColorStateListItem">
<!-- Base color for this state. -->
<attr name="android:color"/>
<!-- Alpha multiplier applied to the base color. -->
<attr format="float" name="alpha"/>
<attr name="android:alpha"/>
<!-- Perceptual luminance applied to the base color. From 0 to 100. -->
<attr format="float" name="lStar"/>
<attr name="android:lStar"/>
</declare-styleable>
<declare-styleable name="FontFamily">
<!-- The authority of the Font Provider to be used for the request. -->
<attr format="string" name="fontProviderAuthority"/>
<!-- The package for the Font Provider to be used for the request. This is used to verify
the identity of the provider. -->
<attr format="string" name="fontProviderPackage"/>
<!-- The query to be sent over to the provider. Refer to your font provider's documentation
on the format of this string. -->
<attr format="string" name="fontProviderQuery"/>
<!-- The sets of hashes for the certificates the provider should be signed with. This is
used to verify the identity of the provider, and is only required if the provider is not
part of the system image. This value may point to one list or a list of lists, where each
individual list represents one collection of signature hashes. Refer to your font provider's
documentation for these values. -->
<attr format="reference" name="fontProviderCerts"/>
<!-- The strategy to be used when fetching font data from a font provider in XML layouts.
This attribute is ignored when the resource is loaded from code, as it is equivalent to the
choice of API between {@link
androidx.core.content.res.ResourcesCompat#getFont(Context, int)} (blocking) and
{@link
androidx.core.content.res.ResourcesCompat#getFont(Context, int, FontCallback, Handler)}
(async). -->
<attr name="fontProviderFetchStrategy">
<!-- The blocking font fetch works as follows.
First, check the local cache, then if the requested font is not cached, request the
font from the provider and wait until it is finished. You can change the length of
the timeout by modifying fontProviderFetchTimeout. If the timeout happens, the
default typeface will be used instead. -->
<enum name="blocking" value="0"/>
<!-- The async font fetch works as follows.
First, check the local cache, then if the requeted font is not cached, trigger a
request the font and continue with layout inflation. Once the font fetch succeeds, the
target text view will be refreshed with the downloaded font data. The
fontProviderFetchTimeout will be ignored if async loading is specified. -->
<enum name="async" value="1"/>
</attr>
<!-- The length of the timeout during fetching. -->
<attr format="integer" name="fontProviderFetchTimeout">
<!-- A special value for the timeout. In this case, the blocking font fetching will not
timeout and wait until a reply is received from the font provider. -->
<enum name="forever" value="-1"/>
</attr>
<!-- Provides the system font family name to check before downloading the font. For
example if the fontProviderQuery asked for "Sans Serif", it is possible to define
fontProviderSystemFontFamily as "sans-serif" to tell the system to use "sans-serif" font
family if it exists on the system. -->
<attr format="string" name="fontProviderSystemFontFamily"/>
</declare-styleable>
<declare-styleable name="FontFamilyFont">
<!-- The style of the given font file. This will be used when the font is being loaded into
the font stack and will override any style information in the font's header tables. If
unspecified, the value in the font's header tables will be used. -->
<attr name="fontStyle">
<enum name="normal" value="0"/>
<enum name="italic" value="1"/>
</attr>
<!-- The reference to the font file to be used. This should be a file in the res/font folder
and should therefore have an R reference value. E.g. @font/myfont -->
<attr format="reference" name="font"/>
<!-- The weight of the given font file. This will be used when the font is being loaded into
the font stack and will override any weight information in the font's header tables. Must
be a positive number, a multiple of 100, and between 100 and 900, inclusive. The most
common values are 400 for regular weight and 700 for bold weight. If unspecified, the value
in the font's header tables will be used. -->
<attr format="integer" name="fontWeight"/>
<!-- The variation settings to be applied to the font. The string should be in the following
format: "'tag1' value1, 'tag2' value2, ...". If the default variation settings should be
used, or the font used does not support variation settings, this attribute needs not be
specified. -->
<attr format="string" name="fontVariationSettings"/>
<!-- The index of the font in the tcc font file. If the font file referenced is not in the
tcc format, this attribute needs not be specified. -->
<attr format="integer" name="ttcIndex"/>
<!-- References to the framework attrs -->
<attr name="android:fontStyle"/>
<attr name="android:font"/>
<attr name="android:fontWeight"/>
<attr name="android:fontVariationSettings"/>
<attr name="android:ttcIndex"/>
</declare-styleable>
<declare-styleable name="GradientColor">
<!-- Start color of the gradient. -->
<attr name="android:startColor"/>
<!-- Optional center color. -->
<attr name="android:centerColor"/>
<!-- End color of the gradient. -->
<attr name="android:endColor"/>
<!-- Type of gradient. The default type is linear. -->
<attr name="android:type"/>
<!-- Only applied to RadialGradient-->
<!-- Radius of the gradient, used only with radial gradient. -->
<attr name="android:gradientRadius"/>
<!-- Only applied to SweepGradient / RadialGradient-->
<!-- X coordinate of the center of the gradient within the path. -->
<attr name="android:centerX"/>
<!-- Y coordinate of the center of the gradient within the path. -->
<attr name="android:centerY"/>
<!-- LinearGradient specific -->
<!-- X coordinate of the start point origin of the gradient.
Defined in same coordinates as the path itself -->
<attr name="android:startX"/>
<!-- Y coordinate of the start point of the gradient within the shape.
Defined in same coordinates as the path itself -->
<attr name="android:startY"/>
<!-- X coordinate of the end point origin of the gradient.
Defined in same coordinates as the path itself -->
<attr name="android:endX"/>
<!-- Y coordinate of the end point of the gradient within the shape.
Defined in same coordinates as the path itself -->
<attr name="android:endY"/>
<!-- Defines the tile mode of the gradient. SweepGradient doesn't support tiling. -->
<attr name="android:tileMode"/>
</declare-styleable>
<declare-styleable name="GradientColorItem">
<!-- The offset (or ratio) of this current color item inside the gradient.
The value is only meaningful when it is between 0 and 1. -->
<attr name="android:offset"/>
<!-- The current color for the offset inside the gradient. -->
<attr name="android:color"/>
</declare-styleable>
</resources>
我的构建梯度文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.testing"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
我遵循了巴沙尔·哈马德所做的工作,并复制粘贴了一个工作项目的build.gradle文件的内容。它实际上解决了这个问题。更仔细地看,这是我注意到的:
从以下位置设置核心和appcompat的实现依赖项
...
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
...
到
...
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
...
由于某种原因,仅更改其中一个并不能解决问题。我猜核心-ktx:1.6.0 和应用程序兼容性:1.3.1 是一起工作的。你不能在不改变另一个的情况下弄乱一个。
顺便说一下,这个问题似乎来自最近的一次Android Studio升级。
它显示找不到某些属性,如DialogComerRadius和fontVariation设置。
警告:不推荐使用属性,它对生成过程没有影响。/home/midhilaj/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/be3106efb0df111fe5a3f7b356dd070b/res/values/values.xml错误:(246,5)错误:resource android:找不到attr/fontvaria
在最近升级了我的android工作室后,我不能再构建我的项目了。 下面显示了我的gradle.build文件: 如有任何帮助,不胜感激。
我的项目基础是在Flutter 1.0上开发的。当升级到2.0并更新代码、插件和它可以运行的一切都可以,但是现在我从Flutter 2.0升级到2.5时,它出现了错误。我无法解决我的项目错误。然后试图用这篇文章解决它,但它不起作用。 控制台错误: 在调试模式下为x86构建的Android SDK上启动lib/main.dart…正在运行Gradle任务“assembleDebug”… 失败:生成失
所以一切都很顺利,当我去编辑一些.xml文件并构建项目时,现在我得到了一个gradle错误,上面写着: Android资源链接失败输出:H:\ Android projects \ codicy \ app \ src \ main \ RES \ layout \ activity _ app _ setup . XML:19:错误:找不到资源drawable/toolbarbackground
我在使用Admob(适用于unity的谷歌移动广告SDK)和适用于unity的Facebook Audience Network SDK进行构建时遇到了这个错误。若我在项目中单独使用其中一个,那个么就不会出现错误,但若我同时使用这两个,那个么我在构建时就会出现这个错误。然而,我已经测试并可以确认,这个错误没有出现在Unity 2020版本中,但它出现在所有Unity 2018以及2019版本中。请