Reputation: 129
I am bit amateur in the android programming and I have trying to implement a project in eclipse. I have already added up the android-support-v7-appcompat.jar as the library. I am getting the error in my toolbar.xml as
error: No resource identifier found for attribute 'theme' in package 'com.example.goon'
Here is my toolbar.xml code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
I am bit confused with what should be done and I would be glad if anyone could help me with the issue. Thanks in advance.
Upvotes: 1
Views: 1101
Reputation: 363677
It happens because the appcompat is a library with own resources and it is not enough to import the jar in your project.
First of all please consider to switch to Android Studio.
It would be very easy to use the library. Just add a dependency in build.gradle
:
dependencies {
// Support Libraries
compile 'com.android.support:appcompat-v7:23.2.0'
}
If you want to use Eclipse please first read this link
Important: Support for the Android Developer Tools (ADT) in Eclipse has ended, per our announcement. You should migrate your app development projects to Android Studio as soon as possible. For more information on transitioning to Android Studio, see Migrating from Eclipse ADT.
In any case you can find all the release of the support libraries library in this folder:
sdk/extras/android/m2repository/com/android/support/
Here you can check all version.
In the folders you will find the aar
file of the support libraries.
Inside you can check the classes.jar
file,the res folder and the AndroidManifest
file.
Create a project in your workspace
Unzip the AAR into some directory.
Copy the AndroidManifest.xml
, the res
, and assets
folders from the AAR into your project.
Create a libs
directory in your project and copy into it the classes.jar
Add the dependency.
Use the SDK 23 to compile
Mark the project as a library
The AppCompat library has the support-v4.jar and the support-annotations-23.x.X.jar as dependencies.
Upvotes: 1
Reputation: 8277
The support v7 lib has its own resources and in order to add that to eclipse you need to follow this
From: https://developer.android.com/tools/support-library/setup.html#libs-with-res
I know this looks like a lot of steps, but in reality it's just very broken down and only takes two minutes
Adding libraries with resources To add a Support Library with resources (such as v7 cardview) to your application project:
Using Eclipse
Create a library project based on the support library code:
Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a library project and ensure the required JAR files are included in the project's build path:
Select File > Import.
Select Existing Android Code Into Workspace and click Next.
Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the cardview project, browse to /extras/android/support/v7/cardview/.
Click Finish to import the project. For the v7 cardview project, you should now see a new project titled android-support-v7-cardview.
In the new library project, expand the libs/ folder, right-click each .jar file and select Build
Path > Add to Build Path. For example, when creating the the v7 cardview project, add the android-support-v7-cardview.jar file to the build path.
Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the cardview project requires you to export the android-support-v7-cardview.jar file.
Uncheck Android Dependencies.
Click OK to complete the changes.
You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the category panel on the left side of the dialog, select Android.
In the Library pane, click the Add button.
Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-cardview.
In the properties window, click OK.
Taken from this answer
Upvotes: 1