我如何解决 Android 中的这个错误? (以非零值结束)
How can i Solve this error in Android? (Finished with a non-zero Value)
我似乎无法通过此错误找到我的程序有什么问题
我的代码对我来说很长 post 我所有的 R. 在我包含这个之后都被红色突出显示了
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>
帮助
添加
multiDexEnabled true
在你的 grandle 文件上
查找并删除可绘制对象的 jpg 变体(android 工作室可以找到它,您也可以)。删除images.jpg、tryagain.jpg等
要检查的事情
- 检查您是否 image.jpg 和 image.png 都在可绘制文件夹中。
如果不是这种情况
- 执行构建 > 清理项目
如果问题仍未解决
- 文件 > 使缓存无效并重新启动
检查你的方法数!
就我而言,我在我的项目中包含了一个大型库(google 播放服务),然后超过了 65k 的方法限制。
用更小的地图库替换它解决了这个问题。
我似乎无法通过此错误找到我的程序有什么问题
我的代码对我来说很长 post 我所有的 R. 在我包含这个之后都被红色突出显示了
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>
帮助
添加
multiDexEnabled true
在你的 grandle 文件上
查找并删除可绘制对象的 jpg 变体(android 工作室可以找到它,您也可以)。删除images.jpg、tryagain.jpg等
要检查的事情
- 检查您是否 image.jpg 和 image.png 都在可绘制文件夹中。
如果不是这种情况
- 执行构建 > 清理项目
如果问题仍未解决
- 文件 > 使缓存无效并重新启动
检查你的方法数!
就我而言,我在我的项目中包含了一个大型库(google 播放服务),然后超过了 65k 的方法限制。
用更小的地图库替换它解决了这个问题。