Cannot import the SimpleCallback class - android

I want to use the SimpleCallback class from the ItemTouchHelper class as seen below, but somehow the import fails. Android Studio says "cannot resolve symbol ItemTouchHelper".
I looked into the android developer site, but I couldn't find any deprecated marker or something like that.
It seems as if it can still be used.
Android Studio is up to date (2.2.3) and the installed APIs too.
The Android Support Plugin is also activated.
I hope someone can help me. Feel free to ask me for details.
Update: Android Studio can't find the helper class. "...widget.helper".
See below:
import android.support.v7.widget.

That "Android Support" plugin says "yes, this IDE can develop Android apps".
It is not literally the Android Support Library.
Please see how to set that up.
And make sure your gradle file contains
dependencies {
...
compile "com.android.support:appcompat-v7:(pick a version)"
}

Related

cannot find symbol class DiskInfo and some other packages despite being present in SDK folder

I have an activity in which i have imported android.os.storage.DiskInfo and some other packages. Android Studio gives errors when trying to make the project saying:
error: cannot find symbol class DiskInfo
When i tried to resolve this problem i found out that all packages are present in folder $SDK-HOME\sources\android-24\android\os\storage but i don't know why Studio couldn't import them properly.
Is there anybody who have experienced problems in import and have solved it?
Thanks
p.s: i am using Android API 24
That is because of #hide in android source code. Actually Android is not allowing developers to use some classes. A solution is to use modified SDK which contains hidden classes. you can find it here https://github.com/anggrayudi/android-hidden-api
Check out : TargetSdk version and support package version.

Flutter Android Support Library Not Recognized

I am writing a Flutter wallpaper app and am calling Android Specific code and I need to ask the user for some permissions, I need to import ContextCompat for that but there is not option to import in the quick menu, so I read online and manually did it.
import android.support.v4.content.ContextCompat
The problem is that Android Studio can't resolve the support symbol, I also read some forums online about that as well. The most common answer I found was to include add the android support library in the Gradle, which I have already tried but did not work.
Any help would be dearly appreciated.
com.android.support:appcompat-v7 should automatically take care of the dependency of ContextCompat
e.g. adding following in the dependency -
implementation 'com.android.support:appcompat-v7:26.1.0'
Here the version 26.1.0 would depend on your compile version.

Find import package for class in intellij idea

I have started using Android studio (intellij idea) for Android development (on Ubuntu 18.05) so I am very new to how it works and more used to visual studio :)
When I type a class name from Android API I note that ide mostly won't have suggestion as to which package to include. I find this to be a complete pain. For example if I type " ApiException aex;" IDE won't have any suggestions for what to include and will just report compile error.
I have various android libraries included in gradle and in the imports list so farily sure this class could be discovered by IDE (shouldn't this be java.lang.* or Google play services/GM's which I have in gradle?)
What is the easiest way to find which import I need for a class eg ApiException and is there a shortcut within Intellij to help with this?
Thank you

Android The import com.google cannot be resolved

I'm trying to test LocationService example of Android developer as per following link http://developer.android.com/training/location/retrieve-current.html. At that time, error message show me that "The import com.google cannot be resolved" for following 5 lines. I'm really confused how to solve this problem.
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
You will need the Google Play Services SDK configured within Eclipse and import google play services as library will dismiss this error .
There is a much simpler solution. In my case, I've gone through all the answers from a few sources and none of them give a straight answer to my problem. Finally, I found a sample app source code and when I import the source code I found out adding the library from Google Play Service Library directory solved it. Google Play Service Library is located (for windows user) here:
\sdk\extras\google\google_play_services\libproject
Import the library into Eclipse as a library project and add this library in your actual project will fix it.
EDIT: This guy made a great contribution on his tutorials how to use Android Google Map v2 step by step and very details. It also includes how to use with Android Support package’s backport of fragments.
http://ddewaele.github.io/GoogleMapsV2WithActionBarSherlock/part1
Assuming you use Eclipse.
Right-click on your project -> properties -> Android.
There use Google API's instead of standard Android.
If you're using Android Studio:
Right click on your app folder -> Open Module Settings -> Dependencies -> Click on the plus button -> Choose library dependency -> Search for "play-services" -> Double click on the com.google.android.gms:play-services
Press Ok and wait for Gradle to rebuild.
You can use this way. First of all close projects which are using google-play-services library. Whenever your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the "Fix project setup" option as below. Then it'll prompt to import the google-play-services library.
If you're using Eclipse, you can fix this by installing Google Play Services SDK via the SDK Manager, load the google-play-services-lib project into Eclipse, and set this as a reference from your project. This is documented at http://developer.android.com/google/play-services/setup.html
Do you use android sdk with google api? If not, do that and it will work.
set your project properties to google api.
You will need the Google Play Services SDK configured within Eclipse.
Maybe useful for some other developers facing this error:
If you are changing to a newer Android Version and if you are using the android-support-library, you have to beware that all projects that you use as library also have the SAME version of the android-support-library. One example would be the actionbar-sherlock. ;)
It Works = Do you use android sdk with google api? If not, do that and it will work.
In project.properties I had to add the following (for ANT build):
android.library.reference.1=${root_prefix}/${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib
If you are using Android studio you may be missing to add gradle to your project.
Add specific play service you want.
Here you may want to compile
com.google.android.gms:play-services-location:10.2.1
Add this to your build.gradle app module in dependencies.
In android studio,add dependency as follows:
In gradle script,go in build.gradle(Module:app) and add these lines
compile 'com.google.android.gms:play-services:10.0.1' in dependencies tag
Here 10.0.1 may be skipped or changed according to your library installed

Android LVL won't Import into Eclipse

I'm trying to get the Android LVL (App Licensing) setup to work with my software... and I cannot get it to import into Eclipse at all. The documentation says, "add the library folder to your workspace"... but it won't let me. I have rev. 2 downloaded... but when I try to import the project (from /android-sdk-macosx/extras/google/play_licensing/library) it shows up greyed-out in the projects list and won't import. Can someone please help me out here?
Just drag the sources into your project. The intention of the LVL is that you build your own sources and make changes (to try to thwart people that modify your binary by looking for LVL-specific bits).

Categories

Resources