AndEngine is one of the easiest tools for making the live wallpapers for Android. It is light weight and also open source project. This tutorial tells you how to setup AndEngine in Android Studio. Using an engine leaves wallpaper extension you can make your own live wallpaper. Let's see how to setup AndEngine in Android studio.
Prerequisite
Prerequisite
In this tutorial
- Android Studio 1.3.2 Build 141.2178183
- AndEngine GLES2-AnchorCenter
Steps
- Setup new project in Android Studio (Steps 1 to 7)
- Add AndEngine in Project (Steps 8 to 18)
- Testing (Steps 19-20)
Step 2-3: Fill your project's necessary details, I just named my project "AndEngine Test". Okay, Then click 'Next'.
Step 4: The next window is "Target Android Device". Just choose target device. I choose Android 4.0.3. Then click 'Next'.
Step 5: The next window is "Add an activity to Mobile". Select "Blank Activity" Then click 'Next'.
Step 6-7: Rename default activity name to 'GameActivity' and click 'Finish'.
Step 8: Change project structure view(optional).
Step 9: Right click on root project and add a directory.
Step 10: Enter name for new directory(in my case its 'other_lib') and click 'OK'.
Step 11: Great..! New directory is created. Now just copy and paste downloaded AndEngine in this directory.
Step 12: Right click on 'AndEngine' and create a new file.
Step 13: Enter name 'build.gradle' in the text box and click 'OK'.
Step 14: Nice one, Now add below code in 'build.gradle'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | apply plugin: 'com.android.library' android { compileSdkVersion 17 buildToolsVersion "19.1" defaultConfig { minSdkVersion 14 targetSdkVersion 19 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } instrumentTest.setRoot('AndEngineTest') } } |
Step 15: Now open 'AndroidManifest.xml' file which is located in 'AndEngine' and add below line.
<application/>
Step16: Open project's 'settings.gradle' file and add this line.
include ':other_lib:AndEngine-GLES2-AnchorCenter'
Step 17: Open app's 'build.gradle' file and add these code in dependencies.
compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':other_lib:AndEngine-GLES2-AnchorCenter')
Step 18: Almost done. Clean Project.
Step 19: Done...! 'AndEngine' successfully added in the project. Start coding.. Copy/paste below code for testing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | package com.example.andenginetest; import org.andengine.engine.camera.Camera; import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.ScreenOrientation; import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.Background; import org.andengine.ui.activity.SimpleBaseGameActivity; import org.andengine.util.adt.color.Color; import java.io.IOException; public class GameActivity extends SimpleBaseGameActivity { private final static int CAMERA_WIDTH = 800; private final static int CAMERA_HEIGHT = 480; @Override protected void onCreateResources() throws IOException { } @Override protected Scene onCreateScene() { Scene scene = new Scene(); scene.setBackground(new Background(Color.BLUE)); return scene; } @Override public EngineOptions onCreateEngineOptions() { Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), camera); } } |
Step 20: Run the project.
HAPPY CODING...
Search Tags:android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio Java game tutorial - AndEngine and Android Studio Setup AndEngine with Android Studio gradle - Unable to add AndEngine to Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio Java game tutorial - AndEngine and Android Studio Setup AndEngine with Android Studio gradle - Unable to add AndEngine to Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine Setup andengine android studio tutorial Create an Andengine App in Android Studio Java game tutorial - AndEngine and Android Studio Setup AndEngine with Android Studio gradle - Unable to add AndEngine to Android Studio android studio andengine tutorial how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup AndEngine with Android Studio Android Studio and AndEngine how to setup andengine in android studio How to Setup Andengine with Android Studio Create an Andengine App in Android Studio Setup
No comments:
Post a Comment