Tuesday, June 17, 2014

Loading Google android API Samples to android studio


If you have tried loading the samples given by google using the sdk manager, you may have come upon a bit of a hickup.
NOTHING WORKS!
This is how to fix it:
Android Studio (Preview) version :  0.6.1
image
let’s import the media router sample project:
located at: C:\Program Files (x86)\Android\android-studio\sdk\samples\android-19\media\BasicMediaRouter
File->import
image
Select BasicMediaRouter, The Android studio will load, but empty:
image
Click on Project and open gradle.build file at root of folder:
image
Double click on the first error stating the build tools version is wrong and what is the correct build tools version:
image image
change the 0.9.+ to whichever is correct, mine is 0.11.+, the change attribute of file from read only to writable dialog will appear, click ok to continue to edit the build tool version the red squiggly line will disappear  meaning you are on your way !
Build->Make Project
image
a new error message comes up in the gradle build tool window: Task ‘assemble’ not found in root project ‘BasicMediaRouter’
What this means is something to do with IDEA changing versions and changing shit with no backward compatibility (thanks guys)
basically easy fix: open up the *.iml file in the root locate the component named FacetManager and delete the entire component
image ==> image
as you click save, the IDE might wish to reload and the IDE will (Finally) get that this is an android application and ask you to configure it:
image
if it doesn’t work go to File->Project Structure
don’t ask me why, but your project is no longer configured for an SDK
image
select an installed SDK in the dropdown menu and click OK
the error: Error:The SDK Build Tools revision (19.0.1) is too low for project ':BasicMediaRouterSample'. Minimum required is 19.1.0 will still be there. Open the build.gradle file that is not in the root directory and change the 19.0.1 to 19.1.0
image
Click on SYNC GRADLE WITH PROJECT FILES image
this is the last thing that will appear, I am unsure what it is but it does no harm either way.

now setup the build properties and click the Ctrl+F5 to load.

Oh and good luck with the rest

No comments: