我添加了一个形象,我想在UI用我的Android项目。我已经添加了文件的我-image.png 的到的绘制的目录下(与项目创建的所有4绘制目录),并添加的ImageView
来布局:
< ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:ID =@ + ID / ImageView的
机器人:layout_alignParentBottom =真
机器人:layout_alignLeft =@ + ID / TextView的
机器人:layout_marginBottom =63dp
机器人:SRC =@可绘制/我的形象/>
现在的问题是,我得到了以下错误:
渲染问题。
未能转换@绘制/我的形象成绘制
这是捕获:
Additionaly,如果我尝试编译项目,我收到以下错误:
摇篮:执行失败的任务:MyProject的:processDebugResources
。为什么会出现这些错误,我该如何解决呢?我失去了一些东西?我刚开始Android的发展。
解决方案 摇篮:执行失败的任务:MyProject的:processDebugResources。
因为你已经命名的资源约定误差
文件名:[A-Z0-9 _]只能包含
重命名文件名 my_image
I have added an image to my Android project which I want to use in the UI. I have added the file my-image.png to the drawable directory (to all 4 drawable directories created with the project), and added the ImageView
to the layout:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/textView"
android:layout_marginBottom="63dp"
android:src="@drawable/my-image" />
The problem is that I get the following error:
Rendering Problems
Failed to convert @drawable/my-image into a drawable
This is the capture:
Additionaly, if I try to compile the project, I get the following error:
Gradle: Execution failed for task ':MyProject:processDebugResources'.
Why do I get these errors and how can I solve it? Am I missing something? I've just started Android development.
解决方案Gradle: Execution failed for task ':MyProject:processDebugResources'.
because you have naming convention error in Resources
file name: must contain only [a-z0-9_.]
Rename file name to my_image