我已将Eclipse中现有的Android项目导入Android Studio。我的资源就像src / main / res文件夹中的图标一样。当我尝试运行该应用程序时出现以下错误: prolog:my_logo.png
中不允许使用内容所以我搜索了一个解决方案,发现我应该使用" src / main / assets"而不是" src / main / res"。然后,我通过单击"文件 - >创建了资源文件夹。新 - >文件夹 - >资产文件夹",将res文件夹的内容移动到新资产文件夹,并尝试再次运行该应用程序。现在我收到了这个错误:
找不到与给定名称匹配的资源(位于'图标'值为' @ drawable / my_logo')。
似乎Android Studio没有查看资源的新资源文件夹。我怎样才能解决这个问题?非常感谢!
答案 0 :(得分:1)
您不应该为图像资源使用assets文件夹。图像应放在项目res目录中的drawable文件夹中。
现在找不到图像的原因是因为public class ItemModal extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_modal);
// ...
ImageView ItemImageV = (ImageView) findViewById(R.id.imageView);
String itemImage = getIntent().getStringExtra("ItemImage");
Glide.with(this).load(itemImage)
.placeholder(R.drawable.ic_img_error)
.error(R.drawable.ic_img_error)
.into(ItemImageV);
}
}
在@drawable
文件夹中查找图像资源。