当前位置: 首页 > 知识库问答 >
问题:

第二个活动只在手机上崩溃,而不是在模拟器上

庄智
2023-03-14

第一个屏幕上传权和工作正常(Toast和所有其他设置和参数),直到我尝试保存结果并通过相同的按钮打开新屏幕。按下按钮会使我手机中的应用程序崩溃,而不会打开第二个屏幕。然而,在模拟器中,一切正常。

这是主要的活动:

public class MainActivity extends AppCompatActivity {

    LineChart lineChart1;
    RadioGroup rg1,rg2;
    Button tipBtn;
    Button checkAndCont;
    int [] mSlop ={-1,3};
    int [] b= {-3,3};
    boolean userAnswer1 = false;
    boolean userAnswer2 = false;
    String quesType = "Slop Recognition";



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        lineChart1 = (LineChart)findViewById(R.id.lineChart1);
        rg1 = (RadioGroup)findViewById(R.id.rg1);
        rg2 = (RadioGroup)findViewById(R.id.rg2);


        tipBtn = (Button)findViewById(R.id.tipBtb);
        tipBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,"גרף במערכת צירים נקרא משמאל לימין",Toast.LENGTH_SHORT ).show();
            }
        });

        checkAndCont = (Button)findViewById(R.id.checkAndCont);




        ArrayList<String> xAxes = new ArrayList<>();
        ArrayList<Entry> yAxesLinear1 = new ArrayList<>();
        ArrayList<Entry> yAxesLinear2 = new ArrayList<>();

        int numberDataPoint = 21;
        for (int i=0 ; i<numberDataPoint;i++ ){
            int x=i-10;
            float funLinear1= mSlop[0]*x+b[0];
            float funLinear2= mSlop[1]*x+b[1];
            yAxesLinear1.add(new Entry(x,funLinear1));
            yAxesLinear2.add(new Entry(x,funLinear2));
            //xAxes.add(i,String.valueOf(x));
        }
        //String [] xaxes = new String[xAxes.size()];
        //for (int i=0; i<xAxes.size(); i++){
        //    xaxes[i]=xAxes.get(i);
        //}

        ArrayList<ILineDataSet> lineDataSet= new ArrayList<>();

        LineDataSet lineDataSet1 = new LineDataSet(yAxesLinear1,"פונקציה קווית 1");
        lineDataSet1.setDrawCircles(false);
        lineDataSet1.setColor(Color.CYAN);
        lineDataSet1.setDrawValues(false);
        lineDataSet1.setLineWidth(3);


        LineDataSet lineDataSet2 = new LineDataSet(yAxesLinear2,"פונקציה קווית 2");
        lineDataSet2.setDrawCircles(false);
        lineDataSet2.setColor(Color.GREEN);
        lineDataSet2.setDrawValues(false);
        lineDataSet2.setLineWidth(3);

        lineDataSet.add(lineDataSet1);
        lineDataSet.add(lineDataSet2);

        lineChart1.setData(new LineData(lineDataSet));

        lineChart1.setDrawBorders(true);
        lineChart1.setBorderColor(0xffff00ff);
        lineChart1.setBorderWidth(2);
        lineChart1.setScaleEnabled(true);
        //lineChart1.setDrawGridBackground(true);
        //lineChart1.setGridBackgroundColor(0xffff00ff);
        //lineChart1.setBackgroundColor(0x00000000);

        XAxis xAxis = lineChart1.getXAxis();
        //xAxis.setEnabled(true);
        xAxis.setDrawAxisLine(true);
        xAxis.setAxisLineColor(Color.WHITE);
        lineChart1.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
        lineChart1.getAxisRight().setEnabled(false);
        lineChart1.getXAxis().setAxisMaximum(10);
        lineChart1.getXAxis().setAxisMinimum(-10);
        lineChart1.getXAxis().setGridColor(0xffff00ff);
        //lineChart1.getXAxis().setDrawAxisLine(true);
        //lineChart1.getXAxis().setAxisLineColor(Color.WHITE); // The buttom limit line of the chart
        //lineChart1.setVisibleXRangeMaximum(50);
        lineChart1.getXAxis().setTextColor(Color.WHITE);
        lineChart1.getXAxis().setTextSize(15);
        LimitLine ll = new LimitLine(0);
        ll.setLineColor(Color.WHITE);
        ll.setLineWidth(1);
        xAxis.addLimitLine(ll);


        YAxis yAxis = lineChart1.getAxisLeft();
        yAxis.setDrawZeroLine(true);
        yAxis.setZeroLineColor(Color.WHITE);// no grid lines
        yAxis.setZeroLineWidth(1); //Sets the line-width of the zero line.
        yAxis.setAxisMinimum(-10f); // start at zero
        yAxis.setAxisMaximum(10f); // the axis maximum is 100
        yAxis.setGridColor(0xffff00ff);
        yAxis.setTextColor(Color.WHITE);
        yAxis.setTextSize(15);

        Legend legend = lineChart1.getLegend();
        legend.setEnabled(true);
        legend.setTextColor(Color.WHITE);
        legend.setTextSize(18);
        legend.setFormSize(13);
        legend.setForm(Legend.LegendForm.CIRCLE);
        legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);

        rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                RadioButton rb1 = (RadioButton) radioGroup.findViewById(i);
                //if(R.id.rg1==i ? userAnswer1==true : userAnswer1==false);
                if (null != rb1 && i > -1) {

                    // checkedId is the RadioButton selected
                    switch (i) {
                        case R.id.rb1:
                            userAnswer1=false;
                            break;

                        case R.id.rb2:
                            userAnswer1=true;
                            break;

                    }
                }
                Toast.makeText(MainActivity.this,Boolean.toString(userAnswer1),Toast.LENGTH_SHORT ).show();
            }
        });

        rg2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                RadioButton rb2 = (RadioButton) radioGroup.findViewById(i);
                //if(R.id.rg1==i ? userAnswer1==true : userAnswer1==false);
                if (null != rb2 && i > -1) {

                    // checkedId is the RadioButton selected
                    switch (i) {
                        case R.id.rb3:
                            userAnswer2=false;
                            break;

                        case R.id.rb4:
                            userAnswer2=true;
                            break;

                    }
                }
                Toast.makeText(MainActivity.this,Boolean.toString(userAnswer2),Toast.LENGTH_SHORT ).show();
            }
        });

    }


    public void result(View view) {
        if (isTrue(mSlop[0])==userAnswer1 && isTrue(mSlop[1])==userAnswer2){
            Toast.makeText(MainActivity.this,"תשובה נכונה",Toast.LENGTH_SHORT ).show();
        }else {
            Toast.makeText(MainActivity.this,"לא נכון",Toast.LENGTH_SHORT ).show();
        }
        startActivity(new Intent(MainActivity.this, Main2Activity.class));
    }

    boolean mType;
    public boolean isTrue (int m){
        if (m >0){
        mType=true;
         }else{
            mType=false;
        }
        return mType;
    }
}

这是相关的XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="5dp"
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:paddingLeft="5dp"
    android:background="@drawable/background_color">

    <com.github.mikephil.charting.charts.LineChart
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:id="@+id/lineChart1">
    </com.github.mikephil.charting.charts.LineChart>


    <TextView
        android:id="@+id/tv1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/lineChart1"
        android:layout_marginStart="187dp"
        android:paddingRight="15dp"
        android:text="פונקציה 1 עולה"
        android:textColor="#00FFFF"
        android:textSize="25sp" />

    <TextView
        android:id="@+id/tv2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/tv1"
        android:layout_marginStart="187dp"
        android:paddingRight="15dp"
        android:text="פונקציה 2 עולה"
        android:textColor="#ff00ff00"
        android:textSize="25sp" />

    <RadioGroup
        android:id="@+id/rg1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_below="@+id/lineChart1"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/rb1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:buttonTint="#00FFFF"
            android:text="לא נכון"
            android:textColor="#00FFFF"
            android:paddingLeft="2dp"
            android:textSize="25sp"
            />

        <RadioButton
            android:id="@+id/rb2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:buttonTint="#00FFFF"
            android:text="נכון"
            android:textColor="#00FFFF"
            android:paddingLeft="2dp"
            android:textSize="25sp"
            android:layout_marginLeft="5sp"/>
    </RadioGroup>

    <RadioGroup
        android:id="@+id/rg2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_below="@+id/rg1"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/rb3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:buttonTint="#ff00ff00"
            android:text="לא נכון"
            android:textColor="#ff00ff00"
            android:paddingLeft="2dp"
            android:textSize="25sp"
            />

        <RadioButton
            android:id="@+id/rb4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:buttonTint="#ff00ff00"
            android:text="נכון"
            android:textColor="#ff00ff00"
            android:paddingLeft="2dp"
            android:textSize="25sp"
            android:layout_marginLeft="5dp"/>
    </RadioGroup>

    <Button
        android:id="@+id/tipBtb"
        android:layout_width="50sp"
        android:layout_height="50sp"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/rg2"
        android:layout_marginStart="66dp"
        android:layout_marginTop="11dp"
        android:scaleType="fitCenter"
        android:text="TIP" />

    <Button
        android:id="@+id/checkAndCont"
        android:text="שלח"
        android:layout_width="80sp"
        android:layout_height="50sp"
        android:layout_marginTop="11dp"
        android:layout_below="@+id/tv2"
        android:layout_centerHorizontal="true"
        android:onClick="result"/>

</RelativeLayout>

这是第二个活动:

public class Main2Activity extends AppCompatActivity {

    LineChart lineChart2;
    Button quickTipBtn,sendAndNext;
    TextView question1,question2;
    EditText answer1,answer2;
    final int [] mSlop ={1,3};
    final int [] b= {1,3};
    private boolean userAnswer1 = false;
    private boolean userAnswer2 = false;
    final String quesType = "y-intercept Recognition";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        question1 = (TextView)findViewById(R.id.question1);
        question2 = (TextView)findViewById(R.id.question2);
        answer1 = (EditText)findViewById(R.id.answer1);
        answer2 = (EditText)findViewById(R.id.answer2);
        quickTipBtn =(Button)findViewById(R.id.quickTipBtn);
        quickTipBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(Main2Activity.this,"קואורדינטת החיתוך עם ציר Y ו b - שווים",Toast.LENGTH_SHORT ).show();
            }
        });
        sendAndNext = (Button)findViewById(R.id.sendAndNext);


        lineChart2 = (LineChart)findViewById(R.id.lineChart2);
        ArrayList<String> xAxes = new ArrayList<>();
        ArrayList<Entry> yAxesLinear1 = new ArrayList<>();
        ArrayList<Entry> yAxesLinear2 = new ArrayList<>();

        int numberDataPoint = 21;
        for (int i=0 ; i<numberDataPoint;i++ ){
            int x=i-10;
            float funLinear1= mSlop[0]*x+b[0];
            float funLinear2= mSlop[1]*x+b[1];
            yAxesLinear1.add(new Entry(x,funLinear1));
            yAxesLinear2.add(new Entry(x,funLinear2));
            //xAxes.add(i,String.valueOf(x));
        }
        //String [] xaxes = new String[xAxes.size()];
        //for (int i=0; i<xAxes.size(); i++){
        //    xaxes[i]=xAxes.get(i);
        //}

        ArrayList<ILineDataSet> lineDataSet= new ArrayList<>();

        LineDataSet lineDataSet1 = new LineDataSet(yAxesLinear1,"פונקציה קווית 1");
        lineDataSet1.setDrawCircles(false);
        lineDataSet1.setColor(Color.CYAN);
        lineDataSet1.setDrawValues(false);
        lineDataSet1.setLineWidth(3);


        LineDataSet lineDataSet2 = new LineDataSet(yAxesLinear2,"פונקציה קווית 2");
        lineDataSet2.setDrawCircles(false);
        lineDataSet2.setColor(Color.GREEN);
        lineDataSet2.setDrawValues(false);
        lineDataSet2.setLineWidth(3);

        lineDataSet.add(lineDataSet1);
        lineDataSet.add(lineDataSet2);

        lineChart2.setData(new LineData(lineDataSet));

        lineChart2.setDrawBorders(true);
        lineChart2.setBorderColor(0xffff00ff);
        lineChart2.setBorderWidth(2);
        lineChart2.setScaleEnabled(true);
        //lineChart1.setDrawGridBackground(true);
        //lineChart1.setGridBackgroundColor(0xffff00ff);
        //lineChart1.setBackgroundColor(0x00000000);

        XAxis xAxis = lineChart2.getXAxis();
        //xAxis.setEnabled(true);
        xAxis.setDrawAxisLine(true);
        xAxis.setAxisLineColor(Color.WHITE);
        lineChart2.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
        lineChart2.getAxisRight().setEnabled(false);
        lineChart2.getXAxis().setAxisMaximum(10);
        lineChart2.getXAxis().setAxisMinimum(-10);
        lineChart2.getXAxis().setGridColor(0xffff00ff);
        //lineChart1.getXAxis().setDrawAxisLine(true);
        //lineChart1.getXAxis().setAxisLineColor(Color.WHITE); // The buttom limit line of the chart
        //lineChart1.setVisibleXRangeMaximum(50);
        lineChart2.getXAxis().setTextColor(Color.WHITE);
        lineChart2.getXAxis().setTextSize(15);
        LimitLine ll = new LimitLine(0);
        ll.setLineColor(Color.WHITE);
        ll.setLineWidth(1);
        xAxis.addLimitLine(ll);


        YAxis yAxis = lineChart2.getAxisLeft();
        yAxis.setDrawZeroLine(true);
        yAxis.setZeroLineColor(Color.WHITE);// no grid lines
        yAxis.setZeroLineWidth(1); //Sets the line-width of the zero line.
        yAxis.setAxisMinimum(-10f); // start at zero
        yAxis.setAxisMaximum(10f); // the axis maximum is 100
        yAxis.setGridColor(0xffff00ff);
        yAxis.setTextColor(Color.WHITE);
        yAxis.setTextSize(15);

        Legend legend = lineChart2.getLegend();
        legend.setEnabled(true);
        legend.setTextColor(Color.WHITE);
        legend.setTextSize(18);
        legend.setFormSize(13);
        legend.setForm(Legend.LegendForm.CIRCLE);
        legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);


    }

    public void sendAndNext(View view) {
        String temValue1= answer1.getText().toString();
        //Toast.makeText(secondScreen.this, answer1.getText(),Toast.LENGTH_LONG).show();
        String temValue2= answer2.getText().toString();
        if (Integer.parseInt(temValue1)==mSlop[0] && Integer.parseInt(temValue2)==mSlop[1]){
            Toast.makeText(Main2Activity.this, "תשובה נכונה",Toast.LENGTH_LONG).show();
        }else {
            Toast.makeText(Main2Activity.this, "תשובה לא נכונה או שלא הוזנו נתונים",Toast.LENGTH_LONG).show();
        }
    }
}

这是第二个XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="5"
    android:gravity="top"
    android:paddingTop="5dp"
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:paddingLeft="5dp"
    android:background="@drawable/background_color2">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3.5"
        android:paddingTop="5dp"
        android:paddingRight="5dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp">
        <com.github.mikephil.charting.charts.LineChart
            android:id="@+id/lineChart2"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            >
        </com.github.mikephil.charting.charts.LineChart>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:paddingTop="5dp"
        android:paddingRight="5dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:orientation="horizontal"
        android:weightSum="2"
        android:gravity="right">

        <EditText
            android:id="@+id/answer1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:digits="0123456789."
            android:inputType="numberSigned"
            android:maxLength="2"
            android:hint="הכנס מספר"
            android:textColorHint="#78ffd6"
            android:textSize="18dp"
            android:textColor="#00FFFF"
            />
        <TextView
            android:id="@+id/question1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1.5"
            android:paddingRight="5dp"
            android:paddingLeft="5dp"
            android:text="למה שווה הפרמטר b ?"
            android:textColor="#00FFFF"
            android:textSize="25sp"
            >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:paddingTop="5dp"
        android:paddingRight="5dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:orientation="horizontal"
        android:weightSum="2"
        android:gravity="right"
        >
        <EditText
            android:id="@+id/answer2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:digits="0123456789."
            android:maxLength="2"
            android:hint="הכנס מספר"
            android:textColorHint="#64f38c"
            android:textSize="18dp"
            android:inputType="numberSigned"
            android:textColor="#ff00ff00"
            />
        <TextView
            android:id="@+id/question2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1.5"
            android:text="מהי נק' החיתוך עם ציר Y?"
            android:textColor="#ff00ff00"
            android:textSize="25sp"
            >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:paddingTop="5dp"
        android:paddingRight="5dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:orientation="horizontal"
        android:weightSum="2"
        android:gravity="center">
        <Button
            android:layout_marginRight="40dp"
            android:id="@+id/quickTipBtn"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="Quick Tip"
            android:background="@android:color/transparent"
            android:textColor="#f05053"

            />
        <Button
            android:id="@+id/sendAndNext"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="Next One"
            android:background="@android:color/transparent"
            android:textColor="#ffafbd"
            android:onClick="sendAndNext"/>
    </LinearLayout>
</LinearLayout>

这是日志猫错误:

致命异常:主< br >进程:com . example . rach mani . mythematix _ linears,PID:18087 Java . lang . runtime异常:无法启动活动component info { com . example . rach mani . mythematix _ linears/com . example . rach mani . mythematix _ linears。main 2 activity }:Android . view . inflate异常:二进制XML文件行#0:inflating类时出错

共有2个答案

商风华
2023-03-14

请检查您的第二个 XML 文件以关闭

从您发布的代码片段来看,很明显您没有关闭第一个LinearLayout标记。希望有帮助!

姬实
2023-03-14

谢谢你的耐心...仔细查看错误日志后,我指出了下一个错误:

com.example.rachmani。mythematix_linears:drawinable/background_color2“(7f060055)不是可绘制的(颜色或路径):TypedValue{t=0x1/d=0x7f060055a=-1 r=0x7f060554}

原始可绘制对象为:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <gradient
                android:startColor="#0f0c29"
                android:endColor="#302b63"
                android:type="linear"
                android:angle="90"/>
        </shape>
    </item>
</selector>

只是将其更改为:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <gradient
                android:startColor="#141e30"
                android:endColor="#243b55"
                android:type="linear"
                android:angle="90"/>
        </shape>
    </item>
</selector>

似乎是我试图使用的渐变背景造成了问题…谢谢大家的支持。

 类似资料:
  • 我想在地图上画一条折线 进口com.google.android.gms.maps.model.Polyline;进口com.google.android.gms.maps.model.PolylineOptions; 导入java.util。ArrayList;导入java.util.List; 公共类 MainActivity extends AppCompatActivity 实现了 OnM

  • 问题内容: 我有以下代码: 在模拟器中工作正常。但是当我在手机上尝试时,它崩溃了。这是控制台: 这行: NSNumberFormatter()。numberFromString(display.text!)! 返回nil,这导致应用程序崩溃,导致无法打开可选包装。我真的不知道怎么了 我正在关注iTunes U中的一些教程。 任何帮助,将不胜感激。 问题答案: 尝试: 因为默认情况下使用设备区域设置

  • 我的MapActive在低API手机上崩溃了。在我的LG G4上没有崩溃。为什么会这样? 这是我的代码: 日志中的错误显示: 致命异常:主进程:com.giladneiger.clubber,PID:22389java.lang.运行时异常:无法启动活动组件信息{com.giladneiger.clubber/com.giladneiger.clubber.MapsActivity}:java.l

  • 我正在尝试使用firefox headless在headless redhat linux构建机器上运行selenium测试。我创建驱动程序的方法如下所示: 我在日志文件中看到的错误如下所示: 我已经检查了机器上是否安装了gtk、glib、pango、xorg和libstdc的正确版本。以前有人在使用无头制造机时遇到过这个问题吗? Firefox版本:|Selenium版本:|GeckDrive版

  • 我被代码卡住了,无法继续。模拟器崩溃,堆栈指向第47行。请帮助初学者! 堆栈错误: 致命的例外:主java。lang.NumberFormatException:无效的int:“t”在java中。整型。invalidInt(Integer.java:138)

  • 我正在尝试在Flutter中构建一个条形码扫描仪应用程序,为此,我正在使用这个插件,我将其添加到,修改了文件并添加了如下简单代码: 上述方法是在按下按钮时调用的。因此,应用程序加载并我单击按钮,整个模拟器崩溃,没有任何日志或错误消息。这是我在流程中记录的整个日志。最后,它说 这是默认相机应用程序的另一个日志。我似乎找不到发生这种情况的原因。我的模拟器设置都是默认的,我没有更改任何设置,除了后置摄像