AAPT: error: ‘请�?�择你理想的专业�?‘ is incompatible with attribute prompt (attr) reference.

  1. 在调试APP时,编译不出来,提示:AAPT: error: ‘请�?�择你理想的专业�?’ is incompatible with
    attribute prompt (attr) reference.

  2. 原因:spinner的
    promote属性直接输入的字符串,没有在strings.xml中定义

在这里插入图片描述

  1. 解决方式:在strings.xml文件中定义一下这个字符串,然后再引用即可

在这里插入图片描述
在这里插入图片描述
已经可以成功运行了
为啥会这样不太清楚,我以为偷懒一下也没事

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
这个问题通常是由于 Android Support 库版本不兼容导致的。解决方法如下: 1. 在 app 模块的 build.gradle 文件中,将 targetSdkVersion 与 compileSdkVersion 版本升级到最新的 Android 版本。 ``` android { compileSdkVersion 31 targetSdkVersion 31 ... } ``` 2. 确保在 dependencies 中使用最新的 Support 库版本。可以在项目根目录下的 build.gradle 文件中设置全局的 Support 库版本: ``` ext { supportLibVersion = "28.0.0" } subprojects { ... dependencies { ... implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:design:$supportLibVersion" ... } } ``` 然后在 app 模块的 build.gradle 文件中使用该全局变量: ``` dependencies { ... implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:design:$supportLibVersion" ... } ``` 3. 如果还是出现上述错误,可以尝试使用 AndroidX 库替换 Support 库。在 app 模块的 build.gradle 文件中添加以下代码: ``` android { ... defaultConfig { ... // 添加以下两行 useLibrary 'androidx.core' javaCompileOptions { annotationProcessorOptions { includeCompileClasspath false } } } ... } ``` 然后将 Support 库依赖替换为对应的 AndroidX 库依赖即可。例如: ``` dependencies { ... implementation 'androidx.appcompat:appcompat:1.4.0' implementation 'com.google.android.material:material:1.5.0-alpha01' ... } ``` 以上是解决 AAPT 错误的一些方法,希望能够帮助到你。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值