我最近将android studio IDE更新为0.8以使用新的Android L SDK.首先,我导入了一个完成的android项目,在旧版本的android studio中没有收到任何错误.在版本0.8 i行如
import android.support.v4.app.Fragment;
get:无法解析支持导致其余代码出错.logcat返回101个实例
Error:(8, 30) error: package android.support.v4.app does not exist
Run Code Online (Sandbox Code Playgroud)
每次我在import语句中调用支持库时为1.
我试过了
不完全确定还剩下什么.
我正在尝试测试位置服务示例,如http://developer.android.com/training/location/retrieve-current.html 我陷入错误,这非常类似于
无法导入com.google.android.gms.location.LocationServices
但我无法解决.
我安装了谷歌pley服务版本(在我的Android SDK管理器中)是17.我知道最新版本是19但是我无法从SDK管理器更新版本,我无法完成这样做的任何选项.
在我的代码中:
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
Run Code Online (Sandbox Code Playgroud)
第二个是好的,第三个是:" 导入....无法解决 "
编辑12/1/2015
我正在使用Eclipse
我正在开发一个跟踪你跑的距离的安卓应用程序。我希望能够同时使用另一个应用程序,例如音乐应用程序。我没有找到关于如何使应用程序在后台运行的任何好的教程,如果有人知道任何好的教程或使应用程序在后台运行的简单解决方案,我真的很感激您是否愿意与我分享。
应用代码:
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.common.SupportErrorDialogFragment;
import java.text.DateFormat;
import java.util.Date;
public class StepCounter extends FragmentActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
// Request code to use when launching the resolution activity
private static final int REQUEST_RESOLVE_ERROR = 1001;
// Unique tag for the error dialog …Run Code Online (Sandbox Code Playgroud)