Android 找不到与给定名称匹配的资源-使用CollasingToolbar时出错
我是Android新手,使用的是折叠工具栏。当我在工具栏中设置图像时,它给出了以下错误。我得到了一个错误,上面写着“Cruncher Cruncher error”,但通过为mdpi和hdpi创建不同的文件解决了这个问题,但后来出现了这个错误Android 找不到与给定名称匹配的资源-使用CollasingToolbar时出错,android,imageview,android-gradle-plugin,build.gradle,android-collapsingtoolbarlayout,Android,Imageview,Android Gradle Plugin,Build.gradle,Android Collapsingtoolbarlayout,我是Android新手,使用的是折叠工具栏。当我在工具栏中设置图像时,它给出了以下错误。我得到了一个错误,上面写着“Cruncher Cruncher error”,但通过为mdpi和hdpi创建不同的文件解决了这个问题,但后来出现了这个错误 AGPBI: {"kind":"error","text":"No resource found that matches the given name (at \u0027src\u0027 with value \u0027@mipmap/winter
AGPBI: {"kind":"error","text":"No resource found that matches the given name (at \u0027src\u0027 with value \u0027@mipmap/wintertiger\u0027).","sources":[{"file":"E:\\Android\\Ewaid\\app\\src\\main\\res\\layout\\activity_edit_user_profile.xml","position":{"startLine":36,"startColumn":29,"startOffset":1597,"endColumn":48,"endOffset":1616}}],"original":""}
我的布局文件:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/appBarLayout">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/collapsingToolBar"
app:contentScrim="?attr/colorPrimary">
<include
android:id="@+id/app_bar"
layout="@layout/app_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_collapseMode="pin"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="fdgfhhg"
android:minHeight="100dp"
android:scaleType="centerCrop"
android:src="@mipmap/wintertiger"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
android:id="@+id/userImage"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
你确定你的抽绳是PNG吗?@Christoma是的。。我通过删除资源并在此处使用AAPT 23.0.1(Windows 10)将资源重新命名为:AGPBI:{“种类”:“错误”,“文本”:“未找到与给定名称匹配的资源(位于\u0027icon\u0027处,具有值\u0027@drawable/ic_launcher\u0027.,“源”:[{“文件”:“C:\\Users\\username\\Documents\\AndroidStudioProjects\\AndroidMobilePushApp\\app\\build\\intermediates\\manifests\\full\\debug\\AndroidManifest.xml”,“位置:{“startLine”:28,“startColumn”:22,“startOffset”:1647,“endColumn”:43,“endOffset”:1668}],“original”:“}”@Thorsten我可以通过更改图像资源来解决此问题。我删除了旧资源并使用了新资源。如果保存扩展名为.png的jpg图像,它将无法工作。
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
AAPT out(1086801821) : No Delegate set : lost message:Done
AAPT out(1772881340) : No Delegate set : lost message:Done
AAPT out(1623148880) : No Delegate set : lost message:Done
AAPT out(256342006) : No Delegate set : lost message:Done
AAPT out(256342006) : No Delegate set : lost message:Done
AAPT out(1086801821) : No Delegate set : lost message:Done
AAPT err(1772881340): libpng error: Not a PNG file
AAPT err(1086801821): libpng error: Not a PNG file
AAPT err(1086801821): libpng error: Not a PNG file
AAPT err(256342006): libpng error: Not a PNG file
AAPT err(256342006): libpng error: Not a PNG file
AAPT err(1623148880): libpng error: Not a PNG file
:app:processDebugManifest
:app:processDebugResources
AGPBI: {"kind":"error","text":"No resource found that matches the given name (at \u0027src\u0027 with value \u0027@mipmap/wintertiger\u0027).","sources":[{"file":"E:\\Android\\Ewaid\\app\\src\\main\\res\\layout\\activity_edit_user_profile.xml","position":{"startLine":36,"startColumn":29,"startOffset":1597,"endColumn":48,"endOffset":1616}}],"original":""}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\pegasus\AppData\Local\Android\sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 10.483 secs