简体   繁体   English

是什么原因导致打开跟踪文件错误:没有这样的文件或目录?

[英]What cause the error opening trace file: No such file or directory?

When I run my app in my mobile device, I get this under the logcat : 当我在移动设备上运行应用程序时,我会在logcat下得到它:

error opening trace file: No such file or directory (2) . 打开跟踪文件时出错:没有这样的文件或目录(2) Any one know what met be the cause? 有人知道原因是什么吗? I tried to re-build the project and clean it under: 我尝试重新构建项目并在以下位置清理它:

Project > Clean... 项目>清洁...

But I still get the same error. 但是我仍然遇到同样的错误。 The app says unfortunately the you cant record on this device, of which is a message I have created under my String.xml files if the phone does not support recordings. 不幸的是,该应用程序说您无法在此设备上录音,如果手机不支持录音,这是我在String.xml文件下创建的一条消息。

Any one with help please do so. 任何有帮助的人都请这样做。 I will be happy to get one. 我会很高兴得到一个。

Here is the code: public class MainActivity extends Activity { 这是代码:公共类MainActivity扩展Activity {

public static final String FILE_DIRECTORY = "iRecorded_Calls";
public ListView listView;
public ScrollView mScrollView;
public TextView mTextView;
public static final String LISTEN_ENABLED = "ListenEnabled";
private static final int CATEGORY_DETAIL = 1;
private static final int NO_MEMORY_CARD = 2;
private static final int TERMS = 3;

public RadioButton radEnable;
public RadioButton radDisable;

public static final int MEDIA_MOUNTED = 0;
public static final int MEDIA_MOUNTED_READ_ONLY = 1;
public static final int NO_MEDIA = 2;

private static Resources res;
private Context context;

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    startActivity(new Intent(this, HomeActivity.class));

    res = getResources();

    listView = (ListView) findViewById(R.id.mylist);        
    mScrollView = (ScrollView) findViewById(R.id.ScrollView02);
    mTextView = (TextView) findViewById(R.id.txtNoRecords);

    SharedPreferences settings = this.getSharedPreferences(LISTEN_ENABLED,
            0);
    boolean silent = settings.getBoolean("silentMode", false);

    if (!silent)
        showDialog(CATEGORY_DETAIL);

    context = this.getBaseContext();

}
//Explorer the file directory 
@SuppressWarnings("deprecation")
@Override
protected void onResume() {
    if (updateExternalStorageState() == MEDIA_MOUNTED) {
        String filepath = Environment.getExternalStorageDirectory()
                .getPath();
        final File file = new File(filepath, FILE_DIRECTORY);

        if (!file.exists()) {
            file.mkdirs();
        }

        final List<Model> listDir = ListDir2(file);

        filepath = getFilesDir().getAbsolutePath();
        final File file2 = new File(filepath, FILE_DIRECTORY);

        if (!file2.exists()) {
            file2.mkdirs();
        }

        final List<Model> listDir2 = ListDir2(file2);

        listDir.addAll(listDir2);

        if (listDir.isEmpty()) {
            mScrollView.setVisibility(TextView.VISIBLE);
            listView.setVisibility(ScrollView.GONE);
        } else {
            mScrollView.setVisibility(TextView.GONE);
            listView.setVisibility(ScrollView.VISIBLE);
        }

        final CallsAdapter adapter = new CallsAdapter(this, listDir);

        listView.setOnItemClickListener(new OnItemClickListener() {

            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                adapter.showPromotionPieceDialog(listDir.get(position)
                        .getCallName(), position);
            }
        });

I managed to figured out what was the problem on my code and fixed it and now I can be able to recorder the incoming and outgoing calls. 我设法找出代码中的问题,并加以解决,现在我可以记录呼入和呼出电话了。 The problem was under my RecordSercive class on the recorder part 问题出在录音机部分的我的RecordSercive类下

> //________Test with the Default outputFormat and default
> Encoder________
> 
>           /*  recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
>               recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
>               recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);*/
>               
>               //_______End for the Test with the Default outputFortmat and default Encoder________

That is where I got the Message that says unfortunately the you cant record on this device 那是我收到的消息, 不幸的是您无法在此设备上记录

So I changed my code to this: 所以我将代码更改为:

> recorder = new MediaRecorder();               
>               recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_DOWNLINK + MediaRecorder.AudioSource.VOICE_UPLINK);//test using the addition sign
> for both DOWNLINK + UPLINK
>               recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
>               recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);                
>               myFileName = getFilename();
>               recorder.setOutputFile(myFileName);

Which worked fine for me, but the sound quality is is a problem, of which I will just have to increase the volume using the 哪个对我来说效果很好,但声音质量是一个问题,我只需要使用

> volume = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

but under the LogCat the on Eclipse when I debug my app, I still get the error opening trace file: No such file or directory (2) . 但是当我调试应用程序时,在Eclipse上的LogCat下,仍然出现打开跟踪文件错误:没有这样的文件或目录(2) Of which I think it might be caused by other reasons of which I'm currently investigating like (Chris Stratton) mentioned. 我认为这可能是由我目前正在调查的其他原因引起的,就像(Chris Stratton)提到的那样。

In the latest version of Android they have clearly restricted working with a network of the main stream. 在最新版本的Android中,他们明显限制了主流网络的使用。 This had been done for UI not to break. 这样做是为了防止UI中断。 Possibly you raised the API version in the manifest. 可能您在清单中提出了API版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 打开跟踪文件时出错:没有这样的文件或目录(2),解决方案? - error opening trace file: No such file or directory (2), Solution? 打开跟踪文件时出错。 没有这样的文件或目录[2] - Error opening trace file. No such file or directory [2] Android - 错误打开跟踪文件:没有这样的文件或目录 - Android - error opening trace file: No such file or directory HttpURLConnection打开跟踪文件时出错:没有这样的文件或目录 - HttpURLConnection Error opening trace file: no such file or directory E / Trace:错误打开跟踪文件:没有这样的文件或目录(2) - E/Trace﹕ error opening trace file: No such file or directory (2) Android E / Trace(627):打开跟踪文件时出错:没有这样的文件或目录(2) - Android E/Trace(627): error opening trace file: No such file or directory (2) Android运行时错误:打开跟踪文件时出错:没有这样的文件或目录(2) - Android runtime error: error opening trace file: No such file or directory (2) LogCat错误打开跟踪文件时出错:没有这样的文件或目录 - LogCat error Error opening trace file: no such file or directory Android上的JDom:打开跟踪文件时出错:没有这样的文件或目录 - JDom on Android: error opening trace file: No such file or directory 打开跟踪文件时出错:没有这样的文件或目录(2)Google日历 - error opening trace file: No such file or directory (2) Google Calendar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM