Неизвестный символ X во время работы тонального анализатора в Android
Я новичок в Android и IBM Watson. Я строю простое приложение, которое анализирует тон ввода текста. Однако при запуске приложения я получаю следующую ошибку:
05-23 15: 14: 04.808 25157-25157 /? I / art: Позднее включение -Xcheck: jni
05-23 15: 14: 04.949 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_dependencies_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.312 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_0_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.350 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_1_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15:14:05.398 25157-25157/com.abhishek.speechtotextapp W/art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_2_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.445 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_3_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.492 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_4_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.535 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_5_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15:14:05.588 25157-25157/com.abhishek.speechtotextapp W/art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_6_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15:14:05.632 25157-25157/com.abhishek.speechtotextapp W/art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_7_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15:14:05.682 25157-25157/com.abhishek.speechtotextapp W/art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_8_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15: 14: 05.721 25157-25157 / com.abhishek.speechtotextapp W / art: Ошибка execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-option =krait --instruction-set-features= по умолчанию --dex-file=/data/app/com.abhishek.speechtotextapp-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.abhishek.speechtotextapp-2@split_lib_slice_9_apk.apk@classes.dex), поскольку состояние выхода не равно 0
05-23 15:14:05.722 25157-25157/com.abhishek.speechtotextapp W/ Система: ClassLoader ссылается на неизвестный путь: /data/app/com.abhishek.speechtotextapp-2/lib/arm
05-23 15: 14: 05.727 25157-25157 / com.abhishek.speechtotextapp I / InstantRun: запуск сервера мгновенного запуска: это основной процесс
05-23 15:14:05.757 25157-25157/com.abhishek.speechtotextapp I/CredentialUtils: поиск строки JNDI недоступен.
05-23 15: 14: 05.890 25157-25331 / com.abhishek.speechtotextapp D / OpenGLRenderer: Использовать EGL_SWAP_BEHAVIOR_PRESERVED: true
? 05-23 15: 14: 05.932 25157-25331 / com.abhishek.speechtotextapp I / Adreno-EGL:: EGL 1.4 Сборка QUALCOMM: недетерминированная_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (Ia6c73e7530) версия 00 Sharer EGL: ESB версии 77.00 OpenGL: Дата сборки: 12/12/15 Пт. Локальная ветвь: mybranch17080070 Удаленная ветвь: quic/LA.BF.1.1.3_rb1.5 Локальные исправления: НЕТ Реконструировать ветвь: НИЧЕГО
05-23 15:14:05.933 25157-25331/com.abhishek.speechtotextapp I/OpenGLRenderer: Инициализированный EGL, версия 1.4
05-23 15: 14: 14.628 25157-25881 / com.abhishek.speechtotextapp W / art: Проверка пустоты okhttp3.HttpUrl.canonicalize(okio.Buffer, java.lang.String, int, int, java.lang.String, булево, булево, булево, логическое) заняло 114,407мс
05-23 15:14:16.233 25157-25881/com.abhishek.speechtotextapp D/OkHttp: -> POST https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2016-05-19 http / 1.1 (16-байтовое тело)
05-23 15: 14: 16.942 25157-25881 / com.abhishek.speechtotextapp D / OkHttp: <- 200 OK https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2016-05-19 (708мс, тело неизвестной длины)
Трассировки стека:
05-23 16: 25: 46.706 14754-15374 / com.abhishek.toneanalyzertest W / System.err: java.lang.IllegalArgumentException: неизвестный символ шаблона 'X'
05-23 16: 25: 46.706 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at java.text.SimpleDateFormat.validatePatternCharacter (SimpleDateFormat.java:323)
05-23 16: 25: 46.706 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at java.text.SimpleDateFormat.validatePattern (SimpleDateFormat.java:312)
05-23 16: 25: 46.706 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at java.text.SimpleDateFormat. (SimpleDateFormat.java:365)
05-23 16: 25: 46.706 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at java.text.SimpleDateFormat. (SimpleDateFormat.java:258)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.DateDeserializer. (DateDeserializer.java:52)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.GsonSingleton.registerTypeAdapters (GsonSingleton.java:53)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.GsonSingleton.createGson (GsonSingleton.java:42)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.GsonSingleton.getGsonWithoutPrettyPrinting (GsonSingleton.java:76)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.ResponseUtils.getObject (ResponseUtils.java:93)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.ResponseConverterUtils $ 3.convert (ResponseConverterUtils.java:79)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.util.ResponseConverterUtils $ 3.convert (ResponseConverterUtils.java:76)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.service.WatsonService.processServiceCall (WatsonService.java:479)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.ibm.watson.developer_cloud.service.WatsonService $ 2.execute (WatsonService.java:254)
05-23 16: 25: 46.707 14754-15374 / com.abhishek.toneanalyzertest W / System.err: at com.abhishek.toneanalyzertest.MainActivity $ MyThread.run (MainActivity.java:128)
05-23 16: 25: 46.711 14754-14754 / com.abhishek.toneanalyzertest D / AndroidRuntime: выключение виртуальной машины
05-23 16:25:46.713 14754-14754/com.abhishek.toneanalyzertest E/AndroidRuntime: ОСНОВНОЕ ИСКЛЮЧЕНИЕ: основной Процесс: com.abhishek.toneanalyzertest, PID: 14754 Тема: темы:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system} java.lang.RuntimeException: сбой при доставке результата ResultInfo{who=null, request=1, result=-1, data=Intent { (имеет дополнительные функции) }} к активности {com.abhishek.toneanalyzertest/com.abhishek.toneanalyzertest.MainActivity}: java.lang.NullPointerException: попытка вызвать виртуальный метод 'java.lang.String com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis.toString()'для ссылки на пустой объект в android.app.ActivityThread.deliverResults(ActivityThread.java:3733) в android.app.ActivityThread.handleSendResult (ActivityThread.java:377) в android.app.ActivityThread.-wrap16(ActivityThread.java) в android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) в android.os.Handler.dispatchMessage(Handler.java:102) в android.os.Looper.loop(Looper.java:148) в android.app.ActivityThread.main(ActivityThread.java:5461) в java.lang.reflect.Method.invoke(Собственный метод) на com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) на com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616). Причина: java.lang.NullPointerException: попытка вызвать виртуальный метод 'java.lang.String com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis.toString ()' для ссылки на пустой объект по адресу com.abhishek.toneanalyzertest.MainActivity.onActivityResult (MainActivity.java:84) в android.app.Activity.dispatchActivityResult (Activity.java:6456) в android.app.ActivityThread.deliverResults (ActivityThread.java:3729) в android.app.ActivityThread.handleSendResult(ActivityThread.java:3776) в android.app.ActivityThread.-wrap16(ActivityThread.java) в android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) в android.os.Handler.dispatchMe ssage (Handler.java:102) в android.os.Looper.loop(Looper.java:148) в android.app.ActivityThread.main(ActivityThread.java:5461) в java.lang.reflect.Method.invoke(родной Method) в com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) в com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Я включил файлы JAR для сервисов Watson и предоставил права пользователя в файле манифеста. В соответствии с ошибкой выше, я получаю хороший ответ (200 coe) от API. Ниже приведен код:
private class cognitiveService extends AsyncTask<Void, Void, Void> {
ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_05_19);
service.setUsernameAndPassword("<username>", "<password>");
@Override
protected Void doInBackground(Void... params) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
txtOutput.setText("analyzing tone");
}
});
ToneAnalysis tone = service.getTone(txt, null).execute();
System.out.println("Tone: " + tone);
} catch (final Exception e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
txtOutput.setText(e.getLocalizedMessage());
}
});
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
}
}
}
1 ответ
Я хотел бы взглянуть на следующий вопрос:
Неизвестный символ шаблона 'X' Исключение при подключении к API разговора IBM Watson из Android
Кажется, это известная проблема, которая была исправлена, но еще не выпущена. Обходной путь обновления до выпуска моментального снимка был рекомендован, пока вы ожидаете выхода исправления в Maven.