Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

How to add "Android Design Support Library" to Eclipse with ADT-plugin?

The Android Developers Blog announced in May 2015:

The Design library is available now, so make sure to update the Android Support Repository in the SDK Manager.

I am using Eclipse (Version: Luna 4.4.2) with latest ADT-plugin and don't see anything "design" in the SDK manager:

SDK manager

When trying to use android.support.design.widget.FloatingActionButton or android.support.design.widget.NavigationView in my projects like this one -

app screenshot

I unfortunately get errors:

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.NavigationView" on path ...

If I would be using Android Studio, I probably needed the line

compile 'com.android.support:design:22.2.0'

but how to fix this in Eclipse? Can I download a JAR file for the design library?

I have searched sdkextrasandroidsupport path, but haven't found any.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Before use the design support library, you have to import support-v7-appcompat library from android-sdksextrasandroidsupportv7appcompat. Then, you have to:

  • create an android library project in eclipse for design support library
  • put the contents of directory android-sdksextrasandroidsupportdesign in the design support library project
  • Link appcompat-v7 library to design support library project
  • Link support library project from your project.

Note: If you can't find the design folder you might want to try this location instead: android-sdkextrasandroidm2repositorycomandroidsupportdesign

You can not use directly the jar android-support-design.jar because you need some resources too (this is the reason of aar format).

For more info just check Error in styles_base.xml file - android app - No resource found that matches the given name 'android:Widget.Material.ActionButton'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...