Reputation: 61
I've been struggling with no luck the past few days to add Chromecast in my Android project, which is built with Maven.
Similarly to as if it were an ANT project, I'm adding the android-support-v7-mediarouter as a library. I do this by adding the following dependency in my pom.xml file:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-mediarouter</artifactId>
<version>18</version>
<type>apklib</type>
</dependency>
The error that I get when I try to build the project is:
No resource found that matches the given name 'Widget.AppCompat.ActionButton'
which I think is quite obvious since the android-support-v7-mediarouter library does not have a reference to android-support-v7-appcompat.
So, my question is; how do I solve that? Any help would be greatly appreciated!
Upvotes: 3
Views: 511
Reputation: 61
So this is how I solved it:
First, I created a POM file (without any dependencies) for the android-support-v7-appcompat library and uploaded the library to my repository.
Then, I created a POM file for the android-support-v7-mediarouter library, adding android-support-v7-appcompat as a dependency (both the apklib and the jar) and uploaded this library to my repository, too.
In my case, I chose to use the CastCompanionLibrary. This library has two dependencies; android-support-v7-mediarouter and google-play-services. Thus, the next step was to create a POM for google-play-services and upload the library to my repository, too. Then, I added a POM to the CastCompanionLibrary where I declared its two dependencies (both the apklibs and the jar files).
Finally, in my project's POM, I added the CastCompanionLibrary as a dependency (just the apklib) and... voila! If you choose to not use the CastCompanionLibrary, then you can simply add android-support-v7-mediarouter and google-play-services as dependencies to your project's POM.
Also, make sure to exclude any existing duplicates when you add the dependencies. For instance, some of the rest of the declared dependencies in my project had a dependency on an older version of android-support-v7-appcompat, which I had to exclude from all of them.
I hope this helps!
Upvotes: 1
Reputation: 19044
I don't know how to set things up in maven but one thing to keep in mind is that the android-support-v7-mediarouter library has dependency on the appcompat support library and to use these in your own project, both of them should be set up as library projects (i.e. you cannnt just add the jars for these libraries to your own project). I am not sure if this information is of use to you regarding your maven set up but just thought I would mention that in case it does.
Upvotes: 1