Introduction: Create an Andengine App in Android Studio
This tutorial assumes you already have Android Studio installed and working, but need to know how to use Andengine in your project.
Andengine is an open source game engine for Android. It is documentation-poor, but feature rich. Unfortunately it was designed to be used with Eclipse. Since google has deprecated support for the ADT eclipse plugin, many people have been wanting to import it into the new gradle based android studio. That isn't as easy as it sounds. After a lot of googling I came up with this. I'm posting it here in the hopes that it will be helpful.
Step 1: Download Andengine From Github
Now switch to the branch GLES2-Anchorcenter.
Click "Download as zip" and extract the files somewhere.
Step 2: Create a New Android Studio Project and Add Module
Open your copy of android studio and create a new project. Use the empty activity option. Name the project as you like.
Now select File -> New Module -> Android Library
Set Application name to AndEngine
Set Module Name to AndEngine
Set Package Name to org.andengine
Set Minimum SDK 14
Click next and select "add no activity"
See the screenshot above.
Step 3: Copying the Files
Now navigate to the folder where you downloaded Andengine. You need to go into src/org/andengine. Copy all of the files to you Android Studio projects folder src/main/java/org/andengine. See screenshot above.
Step 4: Copy the Manifest File
Now enter the folder you downloaded Andengine to. Copy the file "AndroidManifest.xml" and paste it into your project AndEngine/src/main. There will already be a file there, replace it.
Step 5: Add the Module to Your Project
Now it is time to add the module to your project. Select File-> Project Structure -> app -> Dependencies or hit Ctrl-alt-shift-s.
Click the “+” button at the top right and pick “Module Dependency”
Select from the list your AndEngine Module
Check your project gradle in app folder (build.gradle) and make sure you have a line like this under dependencies - compile project(':AndEngine')
You can now use AndEngine in your project.
bugagasha made it!
We have a be nice policy.
Please be positive and constructive.