Android Studio启动模拟器调试APP时闪退的问题 |
您所在的位置:网站首页 › dohna闪退 › Android Studio启动模拟器调试APP时闪退的问题 |
问题描述
17:06 Emulator: dsound: Could not initialize DirectSoundCapture
17:06 Emulator: dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: audio: Failed to create voice `goldfish_audio_in'
17:06 Emulator: D:\AndroidSdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: warning: opening audio input failed
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: audio: Failed to create voice `adc'
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
17:06 Emulator: audio: Failed to create voice `adc'
解决方法
出现以上错误信息时有点疑惑,就是代码并没有错,为了查出是什么原因,我上网找了一下有没有其他人出现这种情况,结果发现还挺多的,但是网上给出的解决方案操作如下: 但是经过上述操作依然解决不了问题。原来问题并不出现在这 private Button getMovies = findViewById(R.id.getMovie_button); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getMovies.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendRequestWithOKHttp(); } }); }从上数代码可以看出在还没加载出layout布局时,我就开始查找button这个控件,因此出现了问题,当我改成一下程序 private Button getMovies; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getMovies = findViewById(R.id.getMovie_button); getMovies.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendRequestWithOKHttp(); } }); }问题就解决了,模拟器能正常运行APP,并且不闪退。
|
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |