Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to import code from GitHub into Android Studio

I feel incredibly dumb asking this, but I've downloaded the sample code of the Android Mobile Vision API available here: https://github.com/googlesamples/android-vision.

I'm trying to import this code into Android Studio so that I am able to just run the sample apps, but no matter how I import (Import Existing Android Studio Project, Import Non-Android Studio Project, Open Project), I am not able to get it imported in a way where I can just compile and hit play to run the app.

Since this is an official sample code from Android, I am sure it shouldn't be this complicated. What am I missing?

like image 748
Pratik Thaker Avatar asked Aug 19 '15 21:08

Pratik Thaker


People also ask

How do I import code from GitHub?

In the upper-right corner of any page, click , and then click Import repository. Under "Your old repository's clone URL", type the URL of the project you want to import. Choose your personal account or an organization to own the repository, then type a name for the repository on GitHub.

How do I authorize GitHub for Android Studio?

On Android Studio: Go to File -> Settings -> Version Control -> GitHub -> Add an account. Click on the "Use Token" hyperlink, like in your screenshot. Paste your token, click login, click ok.

Can I use GitHub Library in Android Studio?

Open your web browser, navigate to the GitHub repository you want to clone, and then copy/paste its URL into the Android Studio dialog. Specify the local directory where you want to store the cloned repository. Give this directory a name, and then click 'Clone. '


1 Answers

There is a "Getting Started" page, which talks about how to import the sample projects:

https://developers.google.com/vision/getting-started

To download and set up the sample application in Android Studio:

  1. Download the Vision samples from Github.

You can either use the "Download ZIP" button on the Github Page or clone on the command line:

git clone https://github.com/googlesamples/android-vision.git

  1. Import the photo-demo project in Android Studio:

Click File > New > Import Project.

In the "Select Eclipse or Gradle Project to Import" window, navigate to the directory where you downloaded the vision samples repository.

Select the "photo-demo" folder and click OK.

Android Studio may prompt you to install the latest version of various Android libraries, especially com.android.gms.play-services in this case. Click "Install Repository and sync project" and follow the instructions.

  1. Connect your device over USB. You should see a notification that says ‘USB Debugging Enabled’. If you don’t see this notification, follow Step 2 here to enable USB debugging on your device, then plug your device in again.

  2. Run the app either by clicking the green arrow in the bar, or go to Run > Run 'app'.

like image 135
pm0733464 Avatar answered Oct 06 '22 04:10

pm0733464