现在我正在使用 Android Studio 并尝试使用 v7-appcompat。
我只是将我的依赖项更新为
dependencies {
compile 'com.android.support:support-v4:18.0.+'
compile "com.android.support:appcompat-v7:18.0.+"
}
并将我的活动更改为范围 ActionBarActivity
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);
return true;
}
}
当我运行它时它没有错误。但是在执行应用程序后,我遇到了“不幸的是已停止”消息。我不知道怎么了。
这是日志猫。
07-23 22:08:00.001 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.AccountServiceProxy.getDeviceId
(AccountServiceProxy.java:116)
at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
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 22:08:00.001 303-868/system_process W/ActivityManager: Unbind failed: could not find
connection for android.os.BinderProxy@41621520