I have recently updated a project that makes use of the Android Support Library ( android-support-v4.jar )
I updated the support library by "Android Tools > Add Support Library"
After doing this my project fails to build and the following imports that worked fine previously now error.
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.SearchViewCompat;
import android.support.v4.widget.SearchViewCompat.OnQueryTextListenerCompat;
With errors long the lines of "The import android.support.v4.widget cannot be resolved"
What have I done wrong? how do I get it working again?
Which API are you using? It is best to use the Android SDK Manager in Eclipse(ADT) plugin to download the support libraries.
The Android Support v4 JAR needs to be in the 'libs' folder of your project. Make sure you have the JAR 'copied' in the folder. It is best to manually do it yourself to make sure it is there.
The best way to fix the 'red' import errors in Eclipse is
Ctrl + Shift + O
to automatically import the correct imports.
Please let me know if this helps! I have had problems with Android imports as well.
Regards,
The jar file also needs to be in your build path.
Related
I updated My Android Support Library Version to 23.1.1?.. But Can't able to find and Import design Library?..
In order to use android design support library, try importing it from your SDK library.
It should be in your_SDK_path/extras/android/support in the folder you can find design, import it as a project in your eclipse and set is as is Library.
Just Refresh, Clean and Build.
You can find your library here inside your SDK
.../sdk/extras/android/support/design/libs
So, import from that, you will get your library.
I am getting error when i want to import google-play-service in Eclipse.
i have import google-play-service-project-lib in Eclipse
i have read all possible Q&A but nothing is work.
I have it added as Library and JAR manually
Then I have tried to clean my project ...
Is there anybody who can solve this problem?
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.
Firstly, try to download latest version of Google Play Services, then:
Remove the existing library to add again manually,
Go to your java build path,
Under project tab add your library and then,
Under order & export tab tick your library,
Apply settings.
After all, just clean the project and library, it should work.
By the way, you can also check this question.
To me it was just a matter of updating the dependencies.
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.6.0'
}
I concluded that if it's already on the latest version, refresh the Gradle may solve the issue - or, as already recommended by Umit Kaya, remove the existing library and add it back.
Even after clicking on Add Support Library and choosing version 19, eclipse still can't find android.support.v4.widget.SwipeRefreshLayout. Does anyone know how to get this to work? I am using
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
I am working on a mac mavericks computer with Juno.
update: import section
import java.util.Observer;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.support.v4.widget.SwipeRefreshLayout;//red underline
Update
By the way, I don't know if this matters: this is an Appengine Connected Android Project, which I build using Google-Eclipse-Plugin
Update 3:
It's looking like the Android Support Library 19.1.0 is not available through the SDK Manager. How else might I obtain it?
It was difficult to update the support library to version 19.1 so i downloaded it manually from https://dl-ssl.google.com/android/repository/support_r19.1.zip and added the jar to my build path manually. works for me. I dont know why the 19 update shows instead of 19.1.0
So it turns out the library is in the following location
/android-sdk-macosx/extras/android/m2repository/com/android/support/support-v4/19.1.0
As opposed to the usual
/android-sdk-macosx/extras/android/support
Also I had to restart eclipse and go to Android SDK Manager over and over and over, until the 19.1.0 version shows up.
I hope this saves someone else some trouble.
The SDK Manager update Android Support Library to 19.1.0.
But when you use Android Tools > Add Support Library, eclipse update Android Support Library to 19.0. I think this is a bug. Copy Android Support Library 19.1.0 to libs folder manually.
It looks as if you don't have the android-support-v4.jar in Java Build Path. Add it from the android-support-v7-appcompat.
For some reason, even though you may include v4 support library or you may have v7-appcompat included in your project, you may not be able to import SwipeRefreshLayout.
You need to make sure that
you change the target=android-19 to target=android-22(It should be anything greater that 19) and
manually import : import android.support.v4.widget.SwipeRefreshLayout; in your activity which will resolve the import related issue.
I had the same problem with old project. But when I create new project, Eclipse can find this import.
It's a problem with updating support library from eclipse: https://code.google.com/p/android/issues/detail?id=67991
Just update it by starting Android SDK manager manually and add new v4 lib to your project.
Thanks for tehnolog's tips.
Update to 19.1 by follow above link -> create new project and import android.support.v4 library -> simply copy android.support.v4.jar to old project's libs folder, Add To BuildPath. SwipeRefreshLayout will appear :D
In androidx, add
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
inorder to use SwipeRefreshLayout
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
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).