文本转语音应用程序在模拟器上运行良好,但在我的两个三星设备上,尽管该语言已经下载并且昨天也可以工作,但它今天不起作用。是关于我的设备还是代码?
这是我的日志猫输出
08-14 20:43:31.358 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.418 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.468 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.508 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.558 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.618 26355-26355/com.example.semra.text_to_speech_app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.semra.text_to_speech_app-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.semra.text_to_speech_app-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
08-14 20:43:31.628 26355-26355/com.example.semra.text_to_speech_app W/System: ClassLoader referenced unknown path: /data/app/com.example.semra.text_to_speech_app-1/lib/arm64
08-14 20:43:31.638 26355-26355/com.example.semra.text_to_speech_app D/ContextRelationManager: ContextRelationManager() : FEATURE_ENABLED=true
08-14 20:43:31.638 26355-26355/com.example.semra.text_to_speech_app I/InstantRun: starting instant run server: is main process
08-14 20:43:31.738 26355-26355/com.example.semra.text_to_speech_app W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
08-14 20:43:31.878 26355-26355/com.example.semra.text_to_speech_app D/TextView: setTypeface with style : 0
08-14 20:43:31.878 26355-26355/com.example.semra.text_to_speech_app D/TextView: setTypeface with style : 0
08-14 20:43:31.918 26355-26355/com.example.semra.text_to_speech_app D/TextView: setTypeface with style : 0
setTypeface with style : 0
08-14 20:43:31.938 26355-26355/com.example.semra.text_to_speech_app D/TextView: setTypeface with style : 0
08-14 20:43:31.998 26355-26355/com.example.semra.text_to_speech_app W/ResourcesManager: Resource getTopLevelResources for package com.samsung.SMToverlayDirs =Null
Resource getTopLevelResources for package com.google.android.ttsoverlayDirs =Null
08-14 20:43:32.008 26355-26355/com.example.semra.text_to_speech_app I/TextToSpeech: Sucessfully bound to com.samsung.SMT
08-14 20:43:32.028 26355-26355/com.example.semra.text_to_speech_app D/SecWifiDisplayUtil: Metadata value : SecSettings2
08-14 20:43:32.028 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{6eff61d I.E...... R.....ID 0,0-0,0}
08-14 20:43:32.038 26355-26549/com.example.semra.text_to_speech_app D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
08-14 20:43:32.058 26355-26355/com.example.semra.text_to_speech_app I/TextToSpeech: Connected to ComponentInfo{com.samsung.SMT/com.samsung.SMT.SamsungTTSService}
08-14 20:43:32.058 26355-26550/com.example.semra.text_to_speech_app I/TextToSpeech: Set up connection to ComponentInfo{com.samsung.SMT/com.samsung.SMT.SamsungTTSService}
08-14 20:43:32.138 26355-26549/com.example.semra.text_to_speech_app I/Adreno: QUALCOMM build : f696b84, I59a6815413
Build Date : 09/29/16
OpenGL ES Shader Compiler Version: XE031.07.00.00
Local Branch :
Remote Branch : quic/LA.BR.1.3.5_rb1.4
Remote Branch : NONE
Reconstruct Branch : NOTHING
08-14 20:43:32.148 26355-26549/com.example.semra.text_to_speech_app I/OpenGLRenderer: Initialized EGL, version 1.4
08-14 20:43:32.188 26355-26355/com.example.semra.text_to_speech_app W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
08-14 20:43:32.198 26355-26549/com.example.semra.text_to_speech_app D/libGLESv1: DTS_GLAPI : DTS is not allowed for Package : com.example.semra.text_to_speech_app
08-14 20:43:32.208 26355-26549/com.example.semra.text_to_speech_app E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
08-14 20:43:32.218 26355-26549/com.example.semra.text_to_speech_app E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
08-14 20:43:32.228 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 63 - 0, 0) vi=Rect(0, 63 - 0, 0) or=1
08-14 20:43:32.248 26355-26355/com.example.semra.text_to_speech_app I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@a201d2 time:2839061
08-14 20:43:33.128 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: ViewPostImeInputStage processPointer 0
08-14 20:43:33.178 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: ViewPostImeInputStage processPointer 1
08-14 20:43:33.368 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: MSG_RESIZED: ci=Rect(0, 63 - 0, 0) vi=Rect(0, 63 - 0, 897) or=1
08-14 20:43:33.938 26355-26355/com.example.semra.text_to_speech_app W/art: Failed to open zip archive '/system/framework/qcom.fmradio.jar': I/O Error
08-14 20:43:35.048 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: ViewPostImeInputStage processPointer 0
08-14 20:43:35.078 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: ViewPostImeInputStage processPointer 1
08-14 20:43:35.098 26355-26355/com.example.semra.text_to_speech_app E/Error: lang_missing_data
08-14 20:43:35.118 26355-26355/com.example.semra.text_to_speech_app D/SecWifiDisplayUtil: Metadata value : SecSettings2
08-14 20:43:35.118 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: #1 mView = android.widget.LinearLayout{bd95b08 V.E...... ......I. 0,0-0,0 #10203a4 android:id/toast_layout_root}
08-14 20:43:35.128 26355-26549/com.example.semra.text_to_speech_app E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
08-14 20:43:35.188 26355-26549/com.example.semra.text_to_speech_app E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
08-14 20:43:35.198 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
08-14 20:43:35.268 26355-26549/com.example.semra.text_to_speech_app D/OpenGLRenderer: endAllStagingAnimators on 0x7fa6613400 (RippleDrawable) with handle 0x7fac7159e0
08-14 20:43:35.528 26355-26355/com.example.semra.text_to_speech_app V/ActivityThread: updateVisibility : ActivityRecord{57862a1 token=android.os.BinderProxy@a201d2 {com.example.semra.text_to_speech_app/com.example.semra.text_to_speech_app.MainActivity}} show : false
08-14 20:43:38.598 26355-26355/com.example.semra.text_to_speech_app D/ViewRootImpl: #3 mView = null
这是我的代码
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
TextToSpeech t_speech;
int result;
EditText edit_text;
String text;
Button b_sp,b_st;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.init();
}
public void init(){
edit_text=(EditText)this.findViewById(R.id.editText);
b_sp=(Button)this.findViewById(R.id.speak);
b_st=(Button)this.findViewById(R.id.stop);
b_sp.setOnClickListener(this);
b_st.setOnClickListener(this);
t_speech=new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if(status==TextToSpeech.SUCCESS){
result=t_speech.setLanguage(new Locale("tr", "TR"));
}
else{
Toast.makeText(getApplicationContext(),"Text To Speech is not supported on your device",Toast.LENGTH_LONG).show();
}
}
});
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.speak){
if(result==TextToSpeech.LANG_MISSING_DATA){
Toast.makeText(getApplicationContext(),"Text To Speech is not supported on your device",Toast.LENGTH_LONG).show();
}
else if( result==TextToSpeech.LANG_NOT_SUPPORTED){
Toast.makeText(getApplicationContext(),"Text To Speech is not supported on your device",Toast.LENGTH_LONG).show();
Log.e("Error","lang_missing_data");
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
}
else {
text = edit_text.getText().toString();
t_speech.speak(text, TextToSpeech.QUEUE_FLUSH, null);
}
}
else if(v.getId()==R.id.stop){
if(t_speech!=null){
t_speech.stop();
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
if(t_speech!=null){
t_speech.stop();
t_speech.shutdown();
}
}
}
有人知道可能出了什么问题或如何调试?
亲切问候
它可以是设备和代码。
我看到的一件主要事情是你把"if(LANG_MISSING_DATA("和"if(LANG_NOT_SUPPORTED("倒写(交换(。
此外,虽然任何设备都可以使用任何引擎,但三星设备通常使用三星语音引擎,而模拟器通常使用谷歌或PICO(PICO很旧,不支持很多语言(。
调试建议:
1( 不要在所有日志中使用完全相同的短语。 如果这样做,则很难判断导致错误的原因。 请改为执行以下操作:
if(status==TextToSpeech.SUCCESS){
result=t_speech.setLanguage(new Locale("tr", "TR"));
}
else{
Toast.makeText(getApplicationContext(),"initialization of tts failed",Toast.LENGTH_LONG).show();
}
。
f(result==TextToSpeech.LANG_NOT_SUPPORTED){
Toast.makeText(getApplicationContext(),"tts does not support the Locale/language specified",Toast.LENGTH_LONG).show();
}
。
if( result==TextToSpeech.LANG_MISSING_DATA){
Toast.makeText(getApplicationContext(),"tts is missing the data required for the locale/language specified",Toast.LENGTH_LONG).show();
另外,还有一件事需要注意,如果您处于离线状态,Google 语音引擎可能会对 result=t_speech.setLanguage 给出误报,然后在您实际请求语音时保持沉默。