Search Google

Wednesday 11 March 2015

The import cannot be resolved & ActionBarActivity cannot be resolved to a type

  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.

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.

    <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> error

Fixing Error in styles.xml to generate : No resource found name 'Theme.AppCompat.Light' 

You are trying to use Theme.AppCompat.Light theme which is a library project. You have to reference this library project to your project.
Now, at first, check that you have installed this library project as follows...
Go Window-->Android SDK Manager then a window named Android SDK Manager will appear as below.
enter image description here
If the Android Support Library is not installed then install it. You can see more information about Android Support Library setup from the below Android Developer site.
Support Library Setup
After Android Support Library setup completion, reference the library to your project from this path...
To reference, follow these steps:
  1. File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"
  2. Project-> properties->Android. In the section library "Add" and choose "appCompat"
  3. 2nd step is VERY IMPORTANT
Now, clean and build your project and run it. I think after all of these, your problem will be solved.

No comments:

Post a Comment