I'm working on a project that unfortunately hasn't been migrated to Android Studio yet. I want to utilize the floating action button in Google's new support.design library but I can't manage to get it included in my project.
I updated the support libraries in the Android SDK Manager.
First, I tried importing the library into Eclipse and adding it as a dependency using Project → Properties → Android on my app but the design project isn't showing up as a library project.
Then I tried copying the .jar form the /libs/
directory of the design library and including that in my project. That allowed me to import android.support.design.widget.FloatingActionButton;
but when I ran the app it crashed because it could not find the resource android.support.design.widget.FloatingActionButton
and couldn't inflate the XML.
Next, I tried adding the imported design project to the build path of the app but I had the same issue as above.
Then I tried adding the JAR from the build path tool, but again I ran into the XML issue.
I tried adding project from my Android SDK's folder as an external class folder but that didn't work.
I'm out of ideas. I realize we should be using Android Studio by now but there's nothing I can do about that. Does anyone know how I could get this working in Eclipse?
Through Eclipse's project properties dialog (Project → Properties), not only can you attach to a library project, but you can mark a project as being a library project.
Normally, when you import a project, that information is pulled from the project.properties
file. Alas, the Android Support Design Project does not have a project.properties
file, and Eclipse's stock import process therefore assumes that you are importing an app.
Just go into Project → Properties → Android and mark the imported library as being a library, via the "Is Library" checkbox. Then, you can attach it to the app that wishes to use the library.
Note that you will need to repeat this "Is Library" nonsense with future editions of the library, when you import those to replace your existing one, when Google ships updates to the library.
All of this headache will go away when you switch to Android Studio (adding libraries is much easier), though it will probably be replaced by new and exciting headaches. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With