简体   繁体   English

Android Studio - 错误:找不到资源可绘制/abc_ic_ab_back_mtrl_am_alpha(又名 com.instacoin:drawable/abc_ic_ab_back_mtrl_am_alpha)

[英]Android Studio - Error:resource drawable/abc_ic_ab_back_mtrl_am_alpha (aka com.instacoin:drawable/abc_ic_ab_back_mtrl_am_alpha) not found

I am getting these errors:我收到这些错误:

Error:resource drawable/abc_ic_ab_back_mtrl_am_alpha (aka com.instacoin:drawable/abc_ic_ab_back_mtrl_am_alpha) not found.错误:未找到可绘制资源/abc_ic_ab_back_mtrl_am_alpha(又名 com.instacoin:drawable/abc_ic_ab_back_mtrl_am_alpha)。

Error:failed linking file resources.错误:链接文件资源失败。

Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details错误:java.util.concurrent.ExecutionException:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2 错误:检查日志以获取详细信息

Error:Execution failed for task ':app:processDebugResources'.错误:任务“:app:processDebugResources”的执行失败。 Failed to execute aapt执行 aapt 失败

This is my AndroidManifest :这是我的AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.instacoin"
android:versionCode="11"
android:versionName="7.3" >

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="23" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<!-- Below is optional -->
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

<permission
    android:name="com.instacoin.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:theme="@style/AppTheme"
    android:name="com.instacoin.MyApplication"
    android:windowSoftInputMode="stateAlwaysHidden">
    <activity android:name="com.chartboost.sdk.CBImpressionActivity"
        android:excludeFromRecents="true"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
        android:configChanges="keyboardHidden|orientation|screenSize" />

    <meta-data android:name="applovin.sdk.key"
        android:value="@string/applovin_sdk_key"  />
    <meta-data android:name="com.revmob.app.id" android:value="@string/revmob_media_id"/>

    <activity android:name="com.revmob.FullscreenActivity"
        android:theme="@android:style/Theme.Translucent"
        android:configChanges="keyboardHidden|orientation">
    </activity>
    <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
    <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
    <activity
        android:name="com.instacoin.ActivitySplashScreen"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.instacoin.ActivityLogin"
        android:label="@string/title_screen_sign_in"
        android:theme="@style/AppTheme"
        android:windowSoftInputMode="stateAlwaysHidden" >
    </activity>
    <activity
        android:name="com.instacoin.ActivityRegister"
        android:label="@string/title_screen_sign_up"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme"
        android:windowSoftInputMode="stateAlwaysHidden" >
    </activity>
    <activity
        android:name="com.instacoin.ActivityMainWallet"
        android:clearTaskOnLaunch="true"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme"
        android:windowSoftInputMode="stateAlwaysHidden" >
    </activity>
   <!-- <activity
        android:name="com.facebook.LoginActivity"
        android:theme="@style/AppTheme"/>-->
    <activity android:name="com.facebook.FacebookActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        tools:replace="android:theme" />

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/sdk_facebook_app_id" />

    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.sensiblewallet" />
        </intent-filter>
    </receiver>
    <receiver android:name="com.instacoin.NotificationReciver" />

    <service android:name="com.instacoin.GCMIntentService" />

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <!-- appgrade -->
    <activity
        android:name="com.appgrade.sdk.view.InterstitialActivity"
        android:theme="@style/InterstitialDialogTheme"/>

    <!-- supersonicads -->
    <activity
        android:name="com.supersonicads.sdk.controller.ControllerActivity"
        android:configChanges="orientation|screenSize"
        android:hardwareAccelerated="true" />
    <activity
        android:name="com.supersonicads.sdk.controller.InterstitialActivity"
        android:configChanges="orientation|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent" />
    <activity
        android:name="com.supersonicads.sdk.controller.OpenUrlActivity"
        android:configChanges="orientation|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent" />

    <!-- TrialPay's activities -->
    <activity
        android:name="com.trialpay.android.views.webcontainer.WebContainerActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|uiMode|touchscreen|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="adjustResize" >
    </activity>
    <activity
        android:name="com.trialpay.android.views.webcontainer.WebContainerPopupActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|uiMode|touchscreen|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" >
    </activity>
    <activity
        android:name="com.trialpay.android.views.videocontainer.VideoContainerActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|uiMode|touchscreen|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
    </activity>
    <!-- persona -->
    <activity android:name="ly.persona.sdk.OffersActivity" />
    <!-- Tapjoy -->
    <activity
        android:name="com.tapjoy.TJAdUnitActivity"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.tapjoy.mraid.view.ActionHandler"
        android:configChanges="orientation|keyboardHidden|screenSize" />
    <activity
        android:name="com.tapjoy.mraid.view.Browser"
        android:configChanges="orientation|keyboardHidden|screenSize" />
    <!-- nativex -->
    <activity
        android:name="com.nativex.monetization.activities.InterstitialActivity"
        android:configChanges="orientation|screenSize"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.nativex.videoplayer.VideoActivity"
        android:configChanges="orientation|screenSize" />

    <!-- required Activity to show Superrewards video ads -->
    <activity
        android:name="com.playerize.superrewards.activities.SRWebViewActivity"
        android:screenOrientation="portrait" />

    <!-- required Activity to show AdscendMedia video ads -->
    <activity
        android:name="com.adscendmedia.sdk.ui.OffersActivity"
        android:configChanges="orientation|screenSize" >
    </activity>

    <!-- required Activity to show Adcolony video ads -->
    <activity
        android:name="com.jirbo.adcolony.AdColonyOverlay"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.jirbo.adcolony.AdColonyFullscreen"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.jirbo.adcolony.AdColonyBrowser"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

    <!-- required Activity to show Vungle video ads -->
    <activity
        android:name="com.vungle.publisher.FullScreenAdActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />


    <activity
        android:name="net.adxmi.android.AdBrowser"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@android:style/Theme.Light.NoTitleBar" >
    </activity>
    <service
        android:name="net.adxmi.android.AdService"
        android:exported="false" >
    </service>

    <!-- Component that rewarded ADs needs -->
    <service
        android:name="net.adxmi.android.ExpService"
        android:exported="false" >
    </service>
    <!-- Optional Component -->
    <receiver
        android:name="net.adxmi.android.AdReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_ADDED" />
            <data android:scheme="package" />
        </intent-filter>
    </receiver>
    <activity android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
    <activity android:name="com.heyzap.sdk.ads.HeyzapVideoActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
    <activity android:name="com.heyzap.sdk.ads.HeyzapProxyActivity" />
    <activity android:name="com.heyzap.sdk.ads.VASTActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
    <activity android:name="com.heyzap.sdk.ads.MediationTestActivity" />
    <receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver">
        <intent-filter>
            <data android:scheme="package"/>
            <action android:name="android.intent.action.PACKAGE_ADDED"/>
        </intent-filter>
    </receiver>


</application>

I just ran into this problem unable to find any solution whatsoever.我刚刚遇到了这个问题,无法找到任何解决方案。

Finally I started checking all the layouts and drawables I had recently made and the error lied in one of them.最后,我开始检查我最近制作的所有布局和可绘制对象,错误在于其中之一。 I had written the import statement twice.我已经写了两次导入语句。

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <!--drawable code here-->
    </item>
</layer-list>

Removing this solved it for me.删除它为我解决了它。 The error displayed by Android Studio pointed nowhere near it. Android Studio 显示的错误根本没有指向它。

In my case, cause of the error was the missing closing tag in one of my vector drawable.就我而言,错误的原因是我的一个矢量可绘制对象中缺少结束标记。 Check whether your xml based drawables have valid format.检查您的基于 xml 的可绘制对象是否具有有效格式。 Misleading is fact that compiler generates many errors pointing to valid drawables, whereas problem may be in only one drawable.误导性的事实是,编译器会生成许多指向有效可绘制对象的错误,而问题可能仅出现在一个可绘制对象中。 Check this answer for more .查看此答案以了解更多信息

In my case the problem caused by two problems, I scared about destroying all my project but it was two simple things, the first which I didn't take care of was naming a drawable something which Android Studio itself may use somewhere which in my case was border.xml , when I created this drawable and then I write some other codes and then I tried to run my project but it couldn't read any of my drawables, so I scared about my project, but then I remembered that this word (border) is something special Android Studio itself may use it in some locations, So I just changed the name to simple_border.xml and then the second problem was just putting two xml defining lines in a single xml file like:-在我的情况下,问题是由两个问题引起的,我害怕破坏我的所有项目,但这是两件简单的事情,第一件我没有注意的是命名一个可绘制的东西, Android Studio本身可能会在某个地方使用它在我的情况下是border.xml ,当我创建这个 drawable 然后我写了一些其他代码然后我尝试运行我的项目但它无法读取我的任何 drawable,所以我害怕我的项目,但后来我想起了这个词(border)是一些特殊的东西Android Studio本身可能会在某些位置使用它,所以我只是将名称更改为simple_border.xml然后第二个问题只是将两个 xml 定义行放在一个 xml 文件中,例如:-

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

So don't scare about this problem, just do some cleaning staff, and remember what did you do in the last coding while, and also don't forget about the naming problem, don't use something special that you think Android Studio itself may use, and also check the last edited xml files for this problem which is duplicating the xml defining line, Hope it helps.所以不要害怕这个问题,做一些清洁工,记住上次编码时你做了什么,也不要忘记命名问题,不要使用你认为Android Studio本身的特殊东西可能会使用,并检查上次编辑的 xml 文件是否存在重复 xml 定义行的问题,希望它有所帮助。

Looks like the file res/layout/earn_credits_list_item.xml is trying to reference a drawable that is not present.看起来文件 res/layout/earn_credits_list_item.xml 试图引用不存在的可绘制对象。 This resource used to exist in support library < 23.2.0 (and briefly in 23.2.1), but was renamed to abc_ic_ab_back_material in 23.2.0 and in 24.0.0 onward.此资源曾经存在于支持库 < 23.2.0(并在 23.2.1 中短暂存在)中,但在 23.2.0 和 24.0.0 之后更名为 abc_ic_ab_back_material。
If you're using support library > 24.0.0 (which you probably are) rename abc_ic_ab_back_mtrl_am_alpha to abc_ic_ab_back_material.如果您使用支持库 > 24.0.0(您可能是),请将 abc_ic_ab_back_mtrl_am_alpha 重命名为 abc_ic_ab_back_material。

i was searching for exactly this error in a few threads and would like anyone who experiences a situation like this to do these steps:我正在几个线程中准确搜索此错误,并希望遇到此类情况的任何人执行以下步骤:

situation:情况:

android studio is throwing errors like @drawable/... not found even renaming files does not solve the problem android studio 抛出错误,如@drawable/... not found即使重命名文件也不能解决问题

solution steps解决步骤

  1. double check the file ( is it present? is the filename valid?)仔细检查文件(是否存在?文件名是否有效?)
  2. if you can examine an error fix it and run an clean / rebuild of the project如果您可以检查错误修复它并运行项目的清理/重建
  3. if this didnt help take the time and use Android Lint its found at Analyse -> inspect code ... it takes some time but its worth it and now ...如果这没有帮助花时间并使用在Analyse找到的 Android Lint -> inspect code ...它需要一些时间,但它值得,现在......
  4. fix every error shown, this isnt a joke those errors could prevent you from building the target.修复显示的每个错误,这不是一个笑话,这些错误可能会阻止您构建目标。 do a clean / rebuild做一个清理/重建
  5. now if this still does not work here are the stranges things ive seen:现在,如果这仍然不起作用,那么我看到的奇怪事情是:

    • in the filename is an invalid char which doesnt show up in the list or at renaming文件名中是一个无效字符,它不会出现在列表中或重命名时
    • the file is converted but its empty文件已转换但为空
    • an file is reverted by git but was deleted in future commits文件被 git 恢复,但在以后的提交中被删除
    • after an code cleanup an xml tag is missing its counterpart代码清理后,xml 标记丢失了对应的标记

where does these errors come from and why they dont show up in the log这些错误来自哪里以及为什么它们没有出现在日志中

android studio is doing an incremental build , so files are proccessed and used again if they weren't changed. android studio 正在执行增量构建,因此如果文件未更改,则会对其进行处理和再次使用。 this leads to the following behaviour:这会导致以下行为:

running an build -> collecting files -> proccessing files -> an error occured运行构建 -> 收集文件 -> 处理文件 -> 发生错误

all other files in the queue arent found as the couldn't get proccessed by build step the following error is shown as the last error occured aka @drawable not found未找到队列中的所有其他文件,因为无法通过构建步骤进行处理,以下错误显示为最后一个错误发生,即@drawable not found

这并没有解决它,我让它工作的唯一方法是卸载 Android Studio 3.0 并安装 2.3 现在它工作正常!

Keep "drawable" file in "res" folder Just cut drawable folder and paste it into res folder将“drawable”文件保存在“res”文件夹中只需剪切drawable文件夹并将其粘贴到res文件夹中在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 res / drawable / abc_ic_ab_back_material.xml资源$ KitFat上的NotFoundException - res/drawable/abc_ic_ab_back_material.xml Resources$NotFoundException on Kitkat Android 错误:AAPT:错误:找不到资源 drawable/ic_bot(又名 com.example.chatbot:drawable/ic_bot) - Android error: AAPT: error: resource drawable/ic_bot (aka com.example.chatbot:drawable/ic_bot) not found 我无法解决错误:找不到资源可绘制/ abc(又名com.example.myapplication:drawable / abc) - I cant solve error:resource drawable/abc (aka com.example.myapplication:drawable/abc) not found 出现“ abc_menu_hardkey_panel_mtrl_mult”复制错误 - Getting “abc_menu_hardkey_panel_mtrl_mult” duplication error Unity项目中的错误:找不到与给定名称匹配的资源(在“ icon”处,值为“ @ drawable / ic_launcher”) - Error in Unity project : No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher') 错误:在eclispe中找不到与给定名称(在&#39;srcCompat&#39;,值为&#39;@ drawable-hdpi / ic_launcher&#39;)匹配的资源 - Error: No resource found that matches the given name (at 'srcCompat' with value '@drawable-hdpi/ic_launcher') in eclispe 每当在 android 工作室中打开新项目时,可绘制文件中的 ic_launcher_background.xml 文件中的错误 - Error in ic_launcher_background.xml file in drawable, whenever new project is opened in android studio Android drawable ic_menu_star 不工作? - Android drawable ic_menu_star not working? 如何修复 AAPT:错误:找不到资源 drawable/tt(又名 com.example.polyresults:drawable/tt) - How to fix AAPT: error: resource drawable/tt (aka com.example.polyresults:drawable/tt) not found 如何在 android 工作室中修复(资源 @drawable/abc_vector_test 在 androix.appcompat:appcompat 中标记为私有) - How to fix in android studio(The resource @drawable/abc_vector_test is marked as private in androix.appcompat:appcompat)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM