Import android.bluetooth.BluetoothGatt cannot be resolved - android

I use Eclipse Luna and turns out I have a bunch of import * cannot be resolved errors.
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
I cleaned the project, i remove it and import it but i have the same error.

BluetoothGatt and other Bluetooth GATT Profile apis were added only in Api Level 18.
So in Project Properties -> Android - > Project Build target , select Target greater than 18.
or just edit project.properties to something like
target=android-20

Related

Cannot resolve symbol 'SCOPE_FILE'

I'm new to app development, and I'm working with Android Studio 3.1.4. I'm working with the Google APIs for sign-in, which have worked well when getting the user's ID, email address, and basic profile. However, I'm now trying to get the Google Drive API working, and I've been stuck for almost two days on this one nagging problem, which is the first step in getting this API to work. Here is the code that's being problematic.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestScopes(Drive.SCOPE_FILE)
.build();
For some reason, SCOPE_FILE is showing up red and I get a tool tip that reads, "Cannot resolve symbol 'SCOPE_FILE'" when I hover over it. Based on everything that I've read, this should not be an issue. I've tried restarting Android Studio and my computer several times. I upgraded to the most recent version of Android Studio and the most recent version of Gradle. I'm pretty sure I've imported all the necessary classes, which are listed here:
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Scope;
import com.google.api.services.drive.Drive;
import com.google.android.gms.tasks.Task;
import java.util.HashSet;
import java.util.Set;
I feel as though this must be a simple issue with a simple solution, but I can't figure it out. What am I missing?
The problem is that you are importing the wrong Drive class, which does not have the SCOPE_FILE field. The solution is to
import com.google.android.gms.drive.Drive;
instead of
import com.google.api.services.drive.Drive;
import this See
import com.google.android.gms.drive.Drive;

an equivalent to matheclipse in android studio

I am working with Android Studio and i want to use the library matheclipse.
Please, is there any library in Android Studio equivalent to "matheclipse" ?
import org.matheclipse.core.convert.AST2Expr;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.parser.client.Parser;
import org.matheclipse.parser.client.ast.ASTNode;
import org.matheclipse.parser.client.ast.FloatNode;
import org.matheclipse.parser.client.ast.FractionNode;
import org.matheclipse.parser.client.ast.FunctionNode;
import org.matheclipse.parser.client.ast.IntegerNode;
import org.matheclipse.parser.client.ast.StringNode;

files.get and .getRequestFactory cannot be resolved

I'm trying to get the metadata of a file in my Google Drive through the fileID but I'm running into some problems using files().get and getRequestFactory().
Specifically I'm looking at this and on the sample it shows the line
File file = service.files().get(fileID).execute(); and
HttpResponse resp = service.getRequestFactory().buildGetRequest(new GenericUrl(file.getDownloadUrl())).execute();
I used these:
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpResponse;
import com.google.api.services.drive.model.File;
as stated in the sample and loaded the com.google.apis:google-api-services-drive:v2-rev168-1.20.0 dependency. But it's still resulting in Cannot resolve method files() and Cannot resolve method getRequestFactory(),
Can anyone shed some light on this?
I have recently run my project with these imports / dependencies without problems, try to double-check your situation
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.FileContent;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.FileList;
import com.google.api.services.drive.model.ParentReference;
com.google.api.services.drive NEEDS
com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc
com.google.api.client NEEDS
com.google.api-client:google-api-client-android:1.20.0
com.google.api.client.json.gson NEEDS
com.google.http-client:google-http-client-gson:1.20.0
The chunk above is pulled from this GitHub test / demo. You're welcome to use it (replace the GDAA referencies in MainActivity with 'REST').
Good Luck

Why android.os.IServiceManager in Android not resolving

I am coding for DialerDemo, But import android.os.IServiceManager;import android.os.ServiceManagerNative; import android.telephony.IPhone; are not resolving
CODE:
package com.umesh.umeshfilereadwritedemo1;
import android.app.Activity;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.IServiceManager;
import android.os.ServiceManagerNative;
import android.telephony.IPhone;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class DialerDemo extends Activity
{
...
...
}
These are all internal classes of the SDK, and are not available publicly.
You cannot build source.android.com applications on their own. They can only be built as part of a firmware image. Please follow the instructions to build the entire firmware. While you can use Eclipse to edit the firmware source, you will still use make to build the firmware.

ADT import of android.media cannot be resolved

i try create my first android application for android 2.1 api level 7 in ADT. I wrote the following line to the default view and eclipse says, that android.media cannot be resolved:
import android.media;
how come, that this doesn't work?
thanks a lot
you cannot import android.media; because it is a package, try using:
import android.media.*;
or
import android.media.MediaPlayer; // if you want to import MediaPlayer
import android.media.Ringtone; // if you want to import Ringtone

Categories

Resources