install android studio [ubuntu]

based on:
https://fredfire1.wordpress.com/2013/10/04/try-android-programming/
https://www.raywenderlich.com/120177/beginning-android-development-tutorial-installing-android-studio
http://tools.android.com/download/studio

open terminal ctrl alt t:

dependencies for linux 64bit:
based on:
http://tools.android.com/tech-docs/linux-32-bit-libraries

sudo dpkg --add-architecture i386
sudo apt update

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1

install it:
sudo apt install openjdk-8-jdk
cd ~/
#wget https://dl.google.com/dl/android/studio/ide-zips/2.1.1.0/android-studio-ide-143.2821654-linux.zip
#wget https://dl.google.com/dl/android/studio/ide-zips/2.1.2.0/android-studio-ide-143.2915827-linux.zip
#wget https://dl.google.com/dl/android/studio/ide-zips/2.2.0.12/android-studio-ide-145.3276617-linux.zip

wget https://dl.google.com/dl/android/studio/ide-zips/2.3.3.0/android-studio-ide-162.4069837-linux.zip
unzip android-studio-ide-*.zip
rm ~/android-studio-*.zip
cd ~/android-studio/bin
./studio.sh

standart > next > next > finish
configure > SDK manager > activate 2.3 (api 9) > apply > accept license > ok
configure > SDK manager > activate 4.1 > apply > accept license > ok

android studio:
configure > SDK manager > activate 4.1 > apply… > ok
start new android studio project > next > next > navigation drawer activity > next > finish
click run button > create new emulator > nexus 4 >kitkat

when you get the screen with “welcome to android studio”
configure > create desktop entry(for all users) > ok

when the program is loaded:
tools > create desktop entry > [x]create entry for all users > ok
tools > android > sdk manager activate 2.3.3 > apply > ok
new application > minimum sdk > 2.3.3

remove android-studio:
sudo apt-get remove openjdk-8-jdk -y
sudo rm -r ~/android-studio/
sudo rm -r ~/Android
sudo rm -r ~/AndroidStudioProjects
sudo rm -r ~/.android
sudo rm -r ~/.AndroidStudio*

remove i386 architecture:
based on: https://wiki.debian.org/Multiarch/HOWTO
sudo apt-get purge ".*:i386"
sudo dpkg --remove-architecture i386
sudo apt-get update

try python for android:
http://qpython.com/

try libgdx (2D /3D game library for android apps):
cd
mkdir -p /home/fredfire1/Tutorials/libgdx
wget https://libgdx.badlogicgames.com/nightlies/dist/gdx-setup.jar
java -jar gdx-setup.jar

choose:
Name:twelve_11_16_libgdx_test
Package:com.fredfire1.libgdx_test
Game class:libgdxTest
Destination:/home/fredfire1/Tutorials/libgdx
Android SDK:/home/fredfire1/Android/Sdk
Sub Projects:[x]Android
Extensions: [x]box2d

generate >YES
use more recent version of build tools > YES
more recent android api > YES

to import that project into Android-studio:
file > open > ~/Tutorials/libgdx/build.gradle

upgrade gradle..

edit file:
core > java > com.fredfire1.libgdx.test

package com.fredfire1.libgdx_test;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; //was 10 before
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.math.Vector3;

public class libgdxTest implements ApplicationListener {

	private PerspectiveCamera camera;
	private ModelBatch modelBatch;
	private Model box;
	private ModelInstance boxInstance;
	private Environment environment;
	@Override

	public void create() {
		// Create camera sized to screens width/height with Field of View of 75 degrees
		camera = new PerspectiveCamera(
				75,
				Gdx.graphics.getWidth(),
				Gdx.graphics.getHeight());
		// Move the camera 3 units back along the z-axis and look at the origin
		camera.position.set(0f,0f,3f);
		camera.lookAt(0f,0f,0f);
		// Near and Far (plane) repesent the minimum and maximum ranges of the camera in, um, units
		camera.near = 0.1f;
		camera.far = 300.0f;
		// A ModelBatch is like a SpriteBatch, just for models.  Use it to batch up geometry for OpenGL
		modelBatch = new ModelBatch();
		// A ModelBuilder can be used to build meshes by hand
		ModelBuilder modelBuilder = new ModelBuilder();
		// It also has the handy ability to make certain premade shapes, like a Cube
		// We pass in a ColorAttribute, making our cubes diffuse ( aka, color ) red.
		// And let openGL know we are interested in the Position and Normal channels
		box = modelBuilder.createBox(2f, 2f, 2f,
				new Material(ColorAttribute.createDiffuse(Color.RED)),
				Usage.Position | Usage.Normal
		);
		// A model holds all of the information about an, um, model, such as vertex data and texture info
		// However, you need an instance to actually render it.  The instance contains all the
		// positioning information ( and more ).  Remember Model==heavy ModelInstance==Light
		boxInstance = new ModelInstance(box,0,0,0);
		// Finally we want some light, or we wont see our color.  The environment gets passed in during
		// the rendering process.  Create one, then create an Ambient ( non-positioned, non-directional ) light.

		environment = new Environment();
		environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.8f, 0.8f, 0.8f, 1.0f));
	}
	@Override
	public void dispose() {
		modelBatch.dispose();
		box.dispose();
	}
	@Override
	public void render() {
		// You've seen all this before, just be sure to clear the GL_DEPTH_BUFFER_BIT when working in 3D
		Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
		// was 10 before
		// For some flavor, lets spin our camera around the Y axis by 1 degree each time render is called
		camera.rotateAround(Vector3.Zero, new Vector3(0,1,0),1f);
		// When you change the camera details, you need to call update();
		// Also note, you need to call update() at least once.
		camera.update();
		// Like spriteBatch, just with models!  pass in the box Instance and the environment
		modelBatch.begin(camera);
		modelBatch.render(boxInstance, environment);
		modelBatch.end();
	}
	@Override
	public void resize(int width, int height) {
	}
	@Override
	public void pause() {
	}
	@Override
	public void resume() {
	}
}

Build > Generate Signed APK:
/home/fredfire1/Tutorials/libgdx/android/android-release.apk

more links about libgdx:
http://blog.codeonion.com/2016/04/21/libgdx-android-studio-download-and-set-up-a-new-libgdx-project/
https://github.com/libgdx/libgdx/wiki
https://github.com/libgdx/libgdx/wiki/Quick-start
https://github.com/libgdx/libgdx/wiki/3D-Graphics
https://github.com/libgdx/libgdx/wiki/3D-animations-and-skinning
https://github.com/libgdx/libgdx/wiki/A-simple-game
https://xoppa.github.io/blog/basic-3d-using-libgdx/
https://xoppa.github.io/blog/loading-a-scene-with-libgdx/
https://xoppa.github.io/blog/using-the-libgdx-3d-physics-bullet-wrapper-part2/
http://www.gamefromscratch.com/page/LibGDX-Tutorial-series.aspx
http://www.gamefromscratch.com/post/2014/01/10/LibGDX-minimal-3D-app.aspx

https://www.youtube.com/watch?v=X3hc6ldolfE

opengl 2:
http://www.learnopengles.com/android-lesson-one-getting-started/
https://developer.android.com/guide/topics/graphics/opengl.html
https://developer.android.com/training/graphics/opengl/index.html

Advertisements

One thought on “install android studio [ubuntu]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s