- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
起初我能够毫无问题地运行所有东西,但突然间,每次我尝试构建时都会出现这个错误,特别是指向这个 xml 文件:C:\Users\Lenovo.gradle\caches\transforms-2\files-2.1\f243f87f287fb4f4052bd069a9b71980\core-1.7.0\res\values\values.xml:105:5 .. 说 AAPT:错误:找不到资源 android:attr/lStar
我什至尝试创建一个新的空项目,但每次尝试运行时仍然会出现问题。那么在这个 XML 文件中创建的问题是什么?
这是我的代码文件:
values.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>
我的构建 gradle 文件:
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'
}
最佳答案
我按照 Bashar Hamade 的做法,复制粘贴了一个工作项目的 build.gradle 文件的内容。它实际上解决了这个问题。更仔细地观察它,这是我注意到的:
为 core 和 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'
...
出于某种原因,仅更改其中一个并不能解决问题。我猜 core-ktx:1.6.0 和 appcompat:1.3.1 一起工作。你不能在不改变另一个的情况下乱搞一个。
关于java - Android Studio Android 资源链接失败错误.. AAPT : error: resource android:attr/lStar not found. at values.xml 105,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70245178/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!