The Import Android.Support Cannot Be Resolved

The import android.support cannot be resolved

Please follow these Steps:

For Eclipse:

  • Go to your Project's Properties
  • Navigate to the Java Build Path
  • Then go to the Libraries tab. There click the Add External JARs Button on the Right pane.
  • Select the android-support-v4.jar file, usually the path for the Jar file is :

    YOUR_DRIVE\android-sdks\extras\android\support\v4\android-support-v4.jar

  • After adding android-support-v4.jar Library, navigate to the Order and Export tab and put check mark on the android-support-v4 Library file.
  • After doing the above, Clean the Project and Build it.
  • Problem Solved.

For Android Studio:

Short Version:

  • Add the following line to your build.gradle file:

    implementation 'com.android.support:support-v4:YOUR_TARGET_VERSION'

Long Version:

  • Go to File -> Project Structure

  • Go to "Dependencies" Tab -> Click on the Plus sign -> Go to "Library dependency"

  • Select the support library "support-v4 (com.android.support:support-v4:YOUR_TARGET_VERSION)"

  • Navigate to your "build.gradle" inside your App Directory and double check if your desired Android Support Library has been added to your dependencies.

  • Rebuild your project and now everything should work.

Further reading regarding this Question:

  1. Support Library - Android Dev
  2. Recent Support Library Revisions
  3. Support Library Packages
  4. What is an Android Support Library?
  5. How Android Support Library work?

I hope this helps.

The Import android.support.v7 cannot be resolved

  1. Go to your project in the navigator, right click on properties.

  2. Go to the Java Build Path tab on the left.

  3. Go to the libraries tab on top.

  4. Click add external jars.

  5. Go to your ADT Bundle folder, go to sdk/extras/android/support/v7/appcompat/libs.

  6. Select the file android-support-v7-appcompat.jar

  7. Go to order and export and check the box next to your new jar.

  8. Click ok.

import android.support cannot be resolved

Right click the project properties->java build path->libraries click add external jar.

browse go to android installation folder like C:\Program Files\Android\android-sdk\extras\android\support\v4 there you find the android_support_v4.jar file then add the jar file and go to order and export tab check the library and click ok..

The import android.support.v7.app cannot be resolved

You need to add the appropriate dependency to your module gradle.build file as follows:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}

Make sure to synchronize your build.gradle file (Right click on file --> Synchronize 'build.gradle') and Clean your project (Build --> Clean Project) after the change.

The import android.support.v7.app cannot be resolved

After you add appcompat_v7 to your dependencies, be sure that the libs folder from your project are empty. By default, an android-support-v4.jar is created when you define your project, so this will cause conflict when you declare appcompat_v7 library as your dependency.

So, the first thing you need to do is check the folder .../My_Project/libs and fearlessly delete the file android-support-v4.jar.

Then, add the appcompat_v7 library as a dependency of your project:
To do this, if you are using Eclipse:

  1. Right click in your project folder, located in the Navigator.
  2. Click in properties, in the final of the list.
  3. In the Properties window, select the Android option (left menu).
  4. In the box Library, add your new reference.

If you are using Android Studio, you can follow the steps mentioned in the @Joey Garcia's comment.

Support Library Setup -
https://developer.android.com/tools/support-library/setup.html

Let me know if it helped you. Good Luck!

How to fix 'Cannot Resolve Symbol 'v7' error in Android Studio

If you are using Android X, try this dependency instead

implementation 'androidx.recyclerview:recyclerview:1.0.0'



Related Topics



Leave a reply



Submit