user2822062
user2822062

Reputation: 31

Cannot import android support library in eclipse

I have imported sample project CastSampleActivity(Googlecast sampleapp for android) in eclipse. I import googlecastsdk manually,and import android support library by operating [Project]-[Android Tools]-[Add Support Library].

After Downloading [Android Support Library,revision 18],[android-support-v4.jar]is in [/libs].

However errors occured in 2 files,1 is CastSampleActivity.java;

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

1 is cast_sample.xml;

"No resource identifier found for attribute 'showAsAction' in package 'com.example.castsample'  cast_sample.xml /CastSampleActivity/res/menu    line 4  Android AAPT Problem"
"No resource identifier found for attribute 'actionProviderClass' in package 'com.example.castsample'   cast_sample.xml /CastSampleActivity/res/menu    line 4  Android AAPT Problem"

anyone haves answer?

Upvotes: 3

Views: 8846

Answers (4)

Edu Ponz
Edu Ponz

Reputation: 37

I fixed it by right-clicking on the project-->Build Path-->Configure Build Path. Once inside go to Java Build Path-->Project's tab and (by clicking add) add the appcompat_v7 library. The import should be resolved.

Upvotes: 1

svahidhoss
svahidhoss

Reputation: 599

If you have issue with broken appcompat_v7 or appcompat_v4 library when you right click on your project - properties - Android , then follow the step on this: https://www.youtube.com/watch?v=5BG1-kZc_qE

After that copy the android-support-v7-appcompat.jar and android-support-v4.jar from the android-support-v7-appcompat project's libs to your own.

Then go back to project - properties - Android and click on add in library section. Select android-support-v7-appcompat or android-support-v4, click ok and you're done. This is how I resolved my issue. :)

Upvotes: 0

thefreeman
thefreeman

Reputation: 1035

There are 2 support libraries you need to import. I followed https://github.com/stigsfoot/cast-android-sample/blob/master/INSTALL_CAST_ECLIPSE.txt and it worked fine for me.

Edit: link is now https://developer.android.com/tools/support-library/setup.html

Upvotes: 0

Ivan_ug
Ivan_ug

Reputation: 2625

Just in case the other answers didnt work, this is what worked for me: Project--Propertes--Android--Is Library--Add.. And added appcompat_v7_2

Upvotes: 4

Related Questions