[안드로이드 TTS 관련 오류]ActivityNotFoundException : Unable to find explicit activity class {com.android.settings/com.android.settings.TextToSpeechSettings}; have you declared this activity in your AndroidManifest.xml?
새로운 오류가 보고 되었다. 오류는 구글픽셀2폰에서 발생된 것으로 확인되었다. 픽셀2폰이 마침 나에게 있다.
그러나 오류는 재현되지 않았다.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.manage.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/com.android.settings.TextToSpeechSettings}; have you declared this activity in your AndroidManifest.xml?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/com.android.settings.TextToSpeechSettings}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2065)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5320)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
at android.app.Activity.startActivityForResult(Activity.java:5278)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
at android.app.Activity.startActivity(Activity.java:5664)
at android.app.Activity.startActivity(Activity.java:5617)
at com.manage.MainActivity.onCreate(MainActivity.java:303)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
안드로이드 11이 설치된 픽셀2폰에서는 TTS관련 설정 액티비티가 존재하지 않는 것일까?
오류가 발생한 코드는 다음과 같다.
public void callTTSettingClicked(View v){
try {
// Unable to find explicit activity class {com.android.settings/com.android.settings.TextToSpeechSettings}; have you declared this activity in your AndroidManifest.xml?
// ComponentName componentToLaunch = new ComponentName(
// "com.android.settings",
// "com.android.settings.TextToSpeechSettings");
// Intent intent = new Intent();
// intent.addCategory(Intent.CATEGORY_LAUNCHER);
// intent.setComponent(componentToLaunch);
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
Intent intent = new Intent();
intent.setAction("com.android.settings.TTS_SETTINGS");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
// Intent intent = new Intent();
// intent.addCategory(Intent.CATEGORY_LAUNCHER);
// intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.TextToSpeechSettings"));
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
}catch (Exception e) {
Toast.makeText(TTSActivity.this, getResources().getString(R.string.cont_24), Toast.LENGTH_LONG).show();
}
}
[연관 자료]