如何修复与FATAl活动和audioFlinger相关的logcat中的错误

时间:2018-12-27 07:56:14

标签: android-studio

我是android world的新手。我尝试构建实时图,但是构建和同步没有错误,但是log cat却是错误。我不知道如何解决它。

这是我的 AndroidManifest 代码。

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:launchMode="singleTop"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

这是我的 mainActivity.java

pa

ckage com.example.nadeesha.sobiga;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.RelativeLayout;

import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.LineData;


public class MainActivity extends AppCompatActivity {

    private RelativeLayout mainLayout;
    private LineChart mChart;


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

//        mainLayout=(RelativeLayout)findViewById(R.id.mainLayout);
        //create line Chart
        mChart= new LineChart(this);
        //add to main layout
        mainLayout.addView(mChart);
        //customize line chart
        mChart.setDescription("");
        mChart.setNoDataTextDescription("No Data at the moment");

        //enable value highlighting
        //Set this to true on your Chart to allow highlighting per dragging over the chart surface when it is fully zoomed out. Default: true
        mChart.setHighlightPerDragEnabled(true);

        // enable touch gestures
        //Allows to enable/disable all possible touch-interactions with the chart.
        mChart.setTouchEnabled(true);

        // Enables/disables dragging (panning) for the chart
        mChart.setDragEnabled(true);

        // Enables/disables scaling for the chart on both axes.
        mChart.setScaleEnabled(true);

        // enough to disable gridlines
        mChart.setDrawGridBackground(false);

        //If set to true, pinch-zooming is enabled. If disabled, x- and y-axis can be zoomed separately.
        mChart.setPinchZoom(true);

        //alternative BackgroundColor
        mChart.setBackgroundColor(Color.BLUE);

        //working on data
        LineData dat1= new LineData();
        dat1.setValueTextColor(Color.WHITE);

        //add data to line chart
        mChart.setData(dat1);



        //get Legend object
        //By default, all chart types support legends and will automatically
        // generate and draw a legend after setting data for the chart. The Legend usually consists of
        // multiple entries each represented by a label an a form/shape.
        Legend Legend1= mChart.getLegend();

        //customize legend

        Legend1.setForm(Legend.LegendForm.LINE);
        Legend1.setTextColor(Color.WHITE);

        XAxis x1=mChart.getXAxis();
        x1.setTextColor(Color.WHITE);
        x1.setDrawGridLines(false);

        // if set to true, the chart will avoid that the first and last label entry
        //     * in the chart "clip" off the edge of the chart
        x1.setAvoidFirstLastClipping(true);

        YAxis y1=mChart.getAxisLeft();
        y1.setTextColor(Color.WHITE);
        y1.setDrawGridLines(false);
        y1.setAxisMaxValue(120f);

        YAxis y2=mChart.getAxisRight();
        y2.setEnabled(false);
    }




}

这是我的 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.nadeesha.sobiga"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation files('libs/mpandroidchartlibrary-2-2-4 (1).jar')
}

我尝试像此视频中那样构建应用。https://www.youtube.com/watch?v=a20EchSQgpw

但是在特定点之后,它会在logcat中显示错误。

2018-12-27 12:55:57.722 12932-13231/? E/AudioFlinger: createRecordTrack_l() initCheck failed -12; no control block?
2018-12-27 12:55:57.723 13649-27886/? E/AudioRecord: AudioFlinger could not create record track, status: -12
2018-12-27 12:55:57.732 13649-27886/? E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status
     

-12。       2018-12-27 12:55:57.732 13649-27886 /? E / android.media.AudioRecord:初始化本机AudioRecord对象时出现错误代码-20。       2018-12-27 12:55:57.732 13649-27886 /? I / MicrophoneInputStream:mic_started com.google.android.apps.gsa.staticplugins.z.c@a009490       2018-12-27 12:55:57.739 13649-27886 /? E / ActivityThread:无法找到提供者信息   com.google.android.apps.gsa.testing.ui.audio.recorded

请帮助我 来解决此问题。

当我尝试打开应用程序时,它显示如下

enter image description here

0 个答案:

没有答案