Skip to content
idelcano edited this page May 13, 2016 · 2 revisions

How configure the environment

1.Android studio and sdk

2.Git clone

3.Git submodules

4.Gradle modifications

5.Git branch

How solve some problems after configure the environment

How track last commit

How guess was the certificate used for a concrete apk

Git-Flow

POEditor

How debug

How configure the environment:

1.Android studio and android sdk.

Download and install following the installation steps: Android Studio

2.Git clone.

To download the pictureapp and all the dependencies (sdk-fork) follow the next steps:

You need a ssh-rsa key in your github user to download the pictureapp and sdk repositories.

Follow the next steps to create a SSH-RSA key and add it in github account link.

It Is possible you need create, and add the generated ssh rsa key in your local file: ~/.ssh/config and add:

Host github.com

forwardAgent yes

You need clone the git repository in your local folder using SSH protocol with the follow commands:

git clone --recursive git@github.com:EyeSeeTea/pictureapp.git

After that, you can open the project in your local folder with android studio.

3.Git Submodules

Copy the DBFlowORM folder into sdk folder.

Move the sdk to 2.22 branch.

You need enter in the picture/sdk folder in the terminal and execute:

git checkout 2.22

The application is using two modules:

DBFlow: We are using a forked version to allow two simultaneous databases

SDK: We are using the 2.22 forked branch to use a new features.

4.Gradle modifications.

Changes to the sdk

In sdk/app/build.gradle

Remove these lines:

apt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'

compile 'com.raizlabs.android:DBFlow-Core:2.2.1'

compile 'com.raizlabs.android:DBFlow:2.2.1'

Add these lines:

apt project(':DBFlowORM:DBFlow-Compiler')

compile project(':DBFlowORM:DBFlow-Core')

compile project(':DBFlowORM:DBFlow')

For sdk 2.22 guava-collections must be changed to avoid dependency conflicts with our app. For that, in the end of the sdk

build.gradle file, you have to remove this line:

compile 'com.google.guava:guava-collections:r03'

and put in its place, this line:

compile 'com.google.guava:guava:18.0'

5.Git branch.

Move to development branch.

git checkout development

And create a new branch from this branch to work in a new feature.

git checkout -b new_feature

Some problems:

  • Gradle version problem: You can try to change the gradle wrapper to fix it.

In android studio go to File>Settings>Build>Execution,Deployment, Build Tools>Gradle. And check "Use default gradle wrapper"

After that click on Build>Clean project.

Android sdk version error:

  • If you have a error "Failed to find target with has string 'android-22' or similar

You only follow need the android studio steps to install the android platform(22 in this case).

After that click on Build>Clean project.

  • If you have a problem "Gradle sync failed: failed to find Build Tools Revision 22.0.1" or similar, follow the android studio steps to download it. After that click on Build>Clean project.

Git Hooks to track last commit

Git hooks to track last commit

We've added post-commit and post-checkout hooks to modify the file app/src/main/res/raw/lastcommit.txt on each commit/checkout to include the commit hash. That way we can track in the app the last commit that generated that apk.

To do it, please follow the following steps:

Open or create the .git/hooks/post-commit and .git/hook/post-checkout files:

If the file does not exist, add the following lines:

#!/bin/sh

gitPath=$(git rev-parse --show-toplevel)

sh ${gitPath}/generate_last_commit.sh

If the file already exist, only add at the end of the file the lines:

`gitPath=$(git rev-parse --show-toplevel)`

sh ${gitPath}/generate_last_commit.sh

Run “git checkout” to update the last commit file

The file app/src/main/res/raw/lastcommit.txt is not in the repository and it’s in the .gitignore file. If the code doesn't find it, it assume “Unavailable”, otherwise it shows the commit that’s written there (built by the generate_last_commit.sh script on each execution of the hook)

Guess what was the certificate used for a concrete apk

keytool -list -printcert -jarfile app.apk

keytool -list -keystore release.jks

Git-Flow

Git-flow is a branching model for git and is used for projects where you might have multiple streams of work running concurrently. With git-flow We Have the following branches :

master: Is the production branch. development: Is a stable branch in constant development , the new features are merged here .

And extra branches for every new feature. The new features will be merged in the development branch.

For more information read this link.

POEditor.

POEditor github hooks configuration

External links: How to use github webhook

find unused strings in androidproject

non transtable strings

Example of github hook to picture in english