如何在Android中解决此错误?(以非零值结束)
我似乎找不到我的程序出了什么问题,请告诉我这个错误 我的代码很长,我可以发布我所有的R。在我包含此代码后,它被突出显示为红色如何在Android中解决此错误?(以非零值结束),android,android-resources,Android,Android Resources,我似乎找不到我的程序出了什么问题,请告诉我这个错误 我的代码很长,我可以发布我所有的R。在我包含此代码后,它被突出显示为红色 LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_root));
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout,
(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Please select a Level!");
text.setTextColor(Color.BLUE);
text.setTextSize(15);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
// toast.getView().setBackgroundColor(Color.BLUE);
toast.setView(layout);
toast.show();
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toast_layout_root"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:background="#DAAA"
>
<ImageView android:src="@drawable/droid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF"
/>
</LinearLayout>
LayoutInflater充气机=getLayoutInflater();
视图布局=充气机。充气(R.layout.toast_布局,
(视图组)findViewById(R.id.toast_layout_root));
TextView text=(TextView)layout.findviewbyd(R.id.text);
setText(“请选择一个级别!”);
text.setTextColor(Color.BLUE);
text.setTextSize(15);
Toast Toast=新Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER,0,0);
toast.setDuration(toast.LENGTH\u SHORT);
//toast.getView().setBackgroundColor(Color.BLUE);
toast.setView(布局);
toast.show();
帮助添加
multiDexEnabled true
在你的grandle文件上
查找并删除您的drawables的jpg变体(android studio可以找到它,您也可以)。删除images.jpg、tryagain.jpg等。要检查的内容
检查你的方法数 在我的例子中,我在我的项目中加入了一个大库(google play services),然后超过了65k方法的限制
将其替换为更小的地图库修复了此问题。请发布您的代码。我的代码很好,只有R有问题。错误消息中有什么不清楚的?您已经创建了
image.jpg
和image.png
。它们竞争相同的名称R.drawable.image
不完全是我的drawable没有。我试图找到它们,但没有找到它们,因为正如您所看到的,它们在我的drawable中不存在)3号帮了我,谢谢。