我開發一個Android應用程序工作,我打運行後,我解開AVD並單擊菜單加載我的申請,我立即得到這個消息:The application Pico TTS (process com.svox..pico) has stopped unexpectedly. Please try again
Android應用不模擬器
這是我的AndroidManifest.xml
:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:allowBackup="true">
<activity android:name=".MPActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
這些都是從我的logcat消息:
10-09 13:01:14.796: I/TextToSpeech.java(1861): initTts() successfully bound to service
10-09 13:01:16.916: E/ActivityThread(1861): Activity com.kelamrsan.MPActivity has leaked ServiceConnection [email protected] that was originally bound here
10-09 13:01:16.916: E/ActivityThread(1861): android.app.ServiceConnectionLeaked: Activity com.kelamrsan.MPActivity has leaked ServiceConnection [email protected] that was originally bound here
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
10-09 13:01:16.916: E/ActivityThread(1861): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
10-09 13:01:16.916: E/ActivityThread(1861): at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:467)
10-09 13:01:16.916: E/ActivityThread(1861): at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:433)
10-09 13:01:16.916: E/ActivityThread(1861): at com.kelamrsan.MPActivity.onCreate(MPActivity.java:47)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-09 13:01:16.916: E/ActivityThread(1861): at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 13:01:16.916: E/ActivityThread(1861): at android.os.Looper.loop(Looper.java:130)
10-09 13:01:16.916: E/ActivityThread(1861): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-09 13:01:16.916: E/ActivityThread(1861): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 13:01:16.916: E/ActivityThread(1861): at java.lang.reflect.Method.invoke(Method.java:507)
10-09 13:01:16.916: E/ActivityThread(1861): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-09 13:01:16.916: E/ActivityThread(1861): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-09 13:01:16.916: E/ActivityThread(1861): at dalvik.system.NativeStart.main(Native Method)
這是我onCreate
:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button buttonLoadImage = (Button)findViewById(R.id.loadimage);
textView = (TextView) findViewById(R.id.textView);
textViewCol = (TextView) findViewById(R.id.textViewColor);
targetImage = (ImageView) findViewById(R.id.targetimage);
textViewVal = (TextView) findViewById(R.id.textViewValue);
mTts = new TextToSpeech(this, new OnInitListener() {
@Override
public void onInit(int status) {
TTSInitialized = true;
}
});
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
buttonLoadImage.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 0);
}});
}
那麼,你覺得這個問題是?
問題是在這裏:在com.kelamrsan.MPActivity.onCreate(MPActivity.java:47) – Kuffs
我感激你的關心, Kuffs。 但我不能解決問題,以前所有的工作都很完美。 但是,我已經更新了這些問題,並在此處添加了創建代碼。看看你能否找到它。 – Sean