Thursday, 18 June 2015

How to import a Google sample Android project to Android Studio


Now, android studio can import numbers of example project directly by:



However google developer website still have a lot of downloadable example projects which didn't support by Android studio importing. for example: http://developer.android.com/training/implementing-navigation/ancestral.html


http://developer.android.com/samples/index.html said you can download them and import them.

But, if you import above example into your android studio you will have issue of unable to find support v4 library, like this:


However, you should have support libraries. To make sure you already have it, you can:



You will still have error, even did this fix.


Solution:

Manually create a project in android studio and manually copy files into the project, very easy and efficient .



Delete "AndroidManifest.xml" file, "res" folder and all things in "java" folder, but keep the empty "java" folder.

Then copy over "AndroidManifest.xml"file , "res" folder and all contents of "src" folder to "java" folder.





No comments:

Post a comment