为什么我的Android项目会崩溃?

时间:2013-04-21 18:21:54

标签: java android eclipse android-emulator crash

我正在Eclipse中编写一个Android应用程序,它使用RitaWordNet查找单词的同义词。它编译但运行崩溃。应用程序是否可能崩溃并且我收到消息“不幸的是RitaWord已停止工作”。是因为我添加到构建路径以使应用程序工作的jar文件是如此之大(> 10 MB)?该计划是:

package com.example.ritaword;
import java.util.Arrays;
import android.*
import rita.wordnet.*;
public class MainActivity extends Activity {
TextView A, B; 
Button ok; 
String[] synonyms; 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ok = (Button)findViewById(android.R.id.button1);
    A = (TextView)findViewById(R.id.textView1);  
    B = (TextView)findViewById(R.id.textView2); 
    B.setText("");
    RiWordnet wordnet = new RiWordnet();
    String word = wordnet.getRandomWord("a");
    synonyms = wordnet.getAllSynonyms(word, "a", 1);
}
public void onClick(View view) {
    switch (view.getId()) {
    case (R.id.button1): 
        if (synonyms != null) {
            Arrays.sort(synonyms);
            B.setText(synonyms[0]);
        } 
        else            
            B.setText("No synyonyms!");
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

如果有帮助,我收到的最后几个错误日志是:

>04-20 22:25:08.239: E/ActivityThread(730):     at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-20 22:25:08.239: E/ActivityThread(730):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-20 22:25:08.239: E/ActivityThread(730):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-20 22:25:08.239: E/ActivityThread(730):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-20 22:25:08.239: E/ActivityThread(730):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-20 22:25:08.239: E/ActivityThread(730):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-20 22:25:08.239: E/ActivityThread(730):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-20 22:25:08.239: E/ActivityThread(730):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-20 22:25:08.239: E/ActivityThread(730):  at java.lang.Thread.run(Thread.java:856)
04-20 22:25:08.319: E/StrictMode(730): null
04-20 22:25:08.319: E/StrictMode(730): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cea428 that was originally bound here
04-20 22:25:08.319: E/StrictMode(730):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-20 22:25:08.319: E/StrictMode(730):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-20 22:25:08.319: E/StrictMode(730):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-20 22:25:08.319: E/StrictMode(730):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-20 22:25:08.319: E/StrictMode(730):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-20 22:25:08.319: E/StrictMode(730):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-20 22:25:08.319: E/StrictMode(730):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-20 22:25:08.319: E/StrictMode(730):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-20 22:25:08.319: E/StrictMode(730):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-20 22:25:08.319: E/StrictMode(730):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-20 22:25:08.319: E/StrictMode(730):  at java.lang.Thread.run(Thread.java:856)

0 个答案:

没有答案