Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio BaseGameUtils

I'm trying to implement Google Play Game Services, and I need to have BaseGameUtils as a library in my project. Following google tutorials I could not find a way to include this in a project that I already have in android studio. Importing manually in Android Studio...

How should I import BaseGameUtils in a project that already exists? What is the best practice?

Should I copy the whole BaseGameUtils in the libs folder in my module? Or should I copy BaseGameUtils in my project folder?

\Project
|--\module
|--|--\libs
|--|--|--android-support-v4.jar
|--|--|--...
|--|--|--\BaseGameUtils
|--|--|--|--...
|--|--\src
|--|--|--...

or

\Project
|--\module
|--|--\libs
|--|--|--android-support-v4.jar
|--|--|--...
|--|--\src
|--|--|--...
|--\libraries
|--|--\BaseGameUtils

Except in the gradle file (in BaseGameUtils) should I mention anywhere else that BaseGameUtils is a library?

like image 752
maclir Avatar asked Jul 10 '13 09:07

maclir


2 Answers

  1. Open File > Project Structure
  2. Click on the + sign in the top left corner
  3. Select "Import Eclipse ADT Project" and click next
  4. Select BaseGameUtils path on your computer like "/android-basic-samples-master/BasicSamples/libraries/BaseGameUtils" and in the next screen you will see module name something like ":BaseGameUtils" then click ok
  5. Click next you would be able to see BaseGameUtils module in your modules
  6. Select your app in the project structure, go to dependencies, click on + sign and select "module dependency" and then select "BaseGameUtils"
  7. Click Ok and your gradle will be rebuild with all the access to BaseGameUtils functions/classes.
like image 62
Rohit Goyal Avatar answered Nov 06 '22 01:11

Rohit Goyal


I have been having the same problem for a long time, but I finally found a solution.

  1. Open your project
  2. Open File > New > Import module
  3. Input your BaseGameUtils library file path
  4. Open your build.gradle file (ProjectName/app/build.gradle)
  5. Add compile project(':BaseGameUtils') to the first line of the dependencies list
  6. Sync project
like image 44
Nathan Bird Avatar answered Nov 06 '22 02:11

Nathan Bird