不幸的是已停止 - 安卓

时间:2013-08-08 06:32:42

标签: android android-appcompat

我在运行时成功编译了,但是当我执行应用程序时,我遇到了这条消息。 “不幸的是已经停止了”

现在我正在尝试使用几天前更新的V7-appcompat。 这是我的源代码。

主要活动

package com.exasmple.oh;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}


@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);

    MenuItem searchItem = menu.findItem(R.id.menu_search);


    return super.onCreateOptionsMenu(menu);
}

} 

菜单

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:yourapp="http://schemas.android.com/apk/res-auto">

<item
    android:id="@+id/menu_search"
    android:title="Menu"
    yourapp:actionViewClass="android.support.v7.widget.SearchView"
    yourapp:showAsAction="always" />

<item
        android:id="@+id/share"
        android:title="Share"
        yourapp:actionViewClass="android.support.v7.widget.ShareActionProvider"
        yourapp:showAsAction="always" />


</menu>

我只更新build.gradle。

compile 'com.android.support:appcompat-v7:18.0.+'

并导入库\\

这不是运行前的任何错误,但它在运行后会发生。

这是我的logcat

07-23 20:40:11.801
784-784/com.android.exchange E/StrictMode: null
android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked
ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d3a3a0 that was
originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
at android.app.ContextImpl.bindService(ContextImpl.java:1418)
at android.app.ContextImpl.bindService(ContextImpl.java:1407)
at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
 at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    at android.os.AsyncTask$2.call(AsyncTask.java:287)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:856)
07-23 20:40:11.811      303-546/system_process W/ActivityManager: Unbind failed: could not find
 connection for android.os.BinderProxy@40e91230

0 个答案:

没有答案