Domanda

I've tried, with zero success so far, to both create a new project and add GoogleCast to it and to get the given examples to work on Android Studio (currently using 0.3.2, but will upgrade if needed) on MacOSX.

Migrating to Eclipse, however, is not a valid option at this time.

I always seem to end up stuck with some reference issue, either giving me the error "No resource found that matches the given name '@style/Theme.AppCompat'." or multiple compile-time errors related to having no idea where android.support.v7 is located at.

Tried many different solutions, such as removing the @style part that someone mentioned to work or setting the v7 path as relative.

Though I wasn't able to follow through with this last one, no idea how to actively do that in AS and not enough reputation to comment there.

Then I came up to this solution Anyone get the chromecast android examples working in android studio?, which seems like a good attempt, except I can't seem to find the mentioned GoogleCastSdkAndroid.jar anywhere, so I'm stuck.

Couldn't find a truly comprehensive tutorial anywhere either, since they all seem to have no issues whatsoever adding v7 to the project.

Thanks in advance for anyone who can donate some of their time to solving this issue.

EDIT: After upgrading to 0.4.6 (is 0.5.1 stable already? Considered how fast it came after 0.5.0...doesn't sound too good); I did what Ali Naddaf suggested, but couple extra questions popped up:

I could build the CastVideos project and import it into Studio with no problem; however, the CastVideos project structure is radically different from a new project's structure (referred to as OtherApp from now on).

The main issue that pops up when I try to mimic CastVideos on OtherApp is that it doesn't find the CastCompanionLibrary project on the OtherApp only, which I can't seem to be able to figure out where exactly should be located at (I thought the 'core' folder was the one with AndroidManifest?).

Also, how do you import modules now? The Project Structure only allows the creation of new modules.

È stato utile?

Soluzione

My suggestions:

  • update your Android Studio
  • open SDK manager and make sure you have the "Android Support Repository" installed
  • create an empty directory on your system (referred to it as <DIR> below)
  • change directory to <DIR> and clone CastCompanionLibrary-android to CastConpanionLibrary $ cd <DIR> $ git clone https://github.com/googlecast/CastCompanionLibrary-android.git CastCompanionLibrary $ git clone https://github.com/googlecast/CastVideos-android.git CastVideos

  • first make sure all is fine by building from command line: $ cd CastVideos $ ./gradlew build it should do a successful build at this point.

  • if all is fine, open your Android Studio and select "Import Project" and point to build.gradle in the CastVideos project.

Now for any other project, you can look at the build.gradle in CastCompanionLibrary or CastVideos to see how you can set up your dependencies on the support libraries; if you don't have dependency on the CastCompnionLibrary, then it is even easier.

Altri suggerimenti

You very much need to upgrade Android Studio. 0.3.2 is quite old and a multitude of bugs have been fixed since then that are almost certainly affecting you.

Other than that, make sure you have the Android Support Repository installed in your SDK Manager. Between those two it should solve your support.v7 errors and @style/Theme.AppCompat issues.

This question is very old but to make it work I had to clone both Git repositories (CastCompanionLibrary & CastVideos-android). Import CCL into Android Studio as Non Android Studio Project, change the version of build tools to current 21.1.10, build the project and close it. Android Studio asked me to reopen the project. Hit yes. Do exactly the same with CastVideos-android and finally I could launch it into my smartphone.

Was really painful, took me 2 hours make sense of the error, because I was trying to open into Android Studio like Android Studio projects (they were) but there was a problem with the .idea file. Tried this and everything worked.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top