我正在尝试将项目从Eclipse迁移到Android Studio,该项目可以在Eclipse中构建并成功导入到Android Studio中,但是,我Cannot resolve symbol 'GooglePlayServicesClient'在Android Studio中遇到错误.
我按照官方教程在Android Studio中导入了Google Play服务,而com.google.android.gms.common.ConnectionResult在我的项目中使用的其他包" "也没有同样的问题.只有' GooglePlayServicesClient'无法解决.

我也尝试过清理并重建我的项目,但问题仍然存在.我究竟做错了什么?
更新:
我的 build.gradle
...
dependencies {
compile project(':libraryListViewAnimations')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:7.0.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-net-3.1-sources.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/mail.jar')
}
Run Code Online (Sandbox Code Playgroud) android gradle google-play-services android-studio build.gradle
我正在尝试使用 C# 将日期 + 时间插入到 Access 数据库中。时间字符串中包含毫秒,例如:
"2015-03-23 11:22:33.123"`
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
string strName = "somestring";
string strDate = "2015-03-23 11:22:33.123"
sql = @"insert into table_name ([name], [date]) values (@Name, @Date)";
using (OleDbCommand command = new OleDbCommand(sql))
{
command.Connection = openCon;
command.Parameters.AddWithValue("@Name", strName);
command.Parameters.AddWithValue("@Date", strDate ); // <-- error here
openCon.Open();
recordsAffected = command.ExecuteNonQuery();
openCon.Close();
}
Run Code Online (Sandbox Code Playgroud)
我在ExcuteNonQuery(); 如果我删除日期时间字符串,则代码有效。
那么如何将带毫秒的日期时间插入到 Access 数据库中呢?
我想实现的东西里面AsyncTask像这样。
@Override
protected void onPreExecute() {
super.onPreExecute();
...
// prevent screen sleep
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
@Override
protected void onPostExecute(List<Result> results) {
super.onPostExecute(results);
getWindow().clearFlag (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
...
}
Run Code Online (Sandbox Code Playgroud)
但是我Cannot resolve method getWindow()在Android Studio中收到错误“ ”。我想念什么?
更新资料
我的AsyncTask的构造函数是:
public MyTask(ProgressDialog pDlg) {
progressDlgReference = new WeakReference<>(pDlg);
progressDlg = progressDlgReference.get();
context = progressDlg.getContext();
...
}
Run Code Online (Sandbox Code Playgroud)
我尝试强制转换context为,Activity但出现运行时错误((Activity) context).getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);?