错误:找不到符合给定名称的资源(在'图标',值为'@ drawable / icon') [英] Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon')

查看:1160
本文介绍了错误:找不到符合给定名称的资源(在'图标',值为'@ drawable / icon')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:找不到与给定名称匹配的资源(icon,值为@ drawable / icon)。



这是我的清单...我非常新,今天早上开始,没有以前的编程经验。

 < manifest xmlns:android = http://schemas.android.com/apk/res/android
package =com.asdf
android:versionCode =1
android:versionName =1.0 >

< uses-sdk
android:minSdkVersion =8
android:targetSdkVersion =19/>

< application
android:allowBackup =true
android:icon =@ drawable / ic_launcher
android:label =@ string / app_name
android:theme =@ style / AppTheme>
< / application>
< application android:label =@ string / app_nameandroid:icon =@ drawable / icon>
< activity android:name =ExampleActivity
android:label =@ string / app_name>
< intent-filter>
< action android:name =android.intent.action.MAIN/>
< category android:name =android.intent.category.LAUNCHER/>
< / intent-filter>
< / activity>
< / application>

< / manifest>


解决方案

发现这个问题。我正在将一个旧项目导入到android工作室,并得到错误。



最终在我这里回答了这个问题图形的mipmap可绘图



在清单中有

 < application 
android:allowBackup =true
android:icon =@ drawable / ic_launcher
...

但@drawable已被@mipmap取代,因此需要更改为:

 < application 
android:allowBackup =true
android:icon =@ mipmap / ic_launcher
。 ..

我把这个答案放在这里,因为它可能会成为一个更常见的问题。

Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon').

This is my manifest... I'm extremely new to this, just started this morning and have no previous programming experience.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asdf"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="19" />

 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
 </application>
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="ExampleActivity"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
</application>

</manifest>

解决方案

Found this question. I was importing an old project into android studio and got the error.

The issue was eventually answered for me here mipmap drawables for icons

In the manifest it has

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
...

but @drawable has been superseded by @mipmap so needed changing to:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
...

I put this answer here, as it may become a more common issue.

这篇关于错误:找不到符合给定名称的资源(在'图标',值为'@ drawable / icon')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆