Travis Ci と Github で Android 開発な .travis.yml

Travis_CI__Configuring_your_build

何かと使えるようなのでメモ.

language: java

jdk:
  - openjdk7
  - openjdk6
  - oraclejdk7
  - oraclejdk8

branches:
  only:
    - dev
    - master
env:
  global:
    - ANDROID_SDK_VERSION=“r22.6.2"
before_install:

# required libs for android build tools
# Update a system for ia32 libraries
  - sudo apt-get update -qq
  - if [ `uname -m` = x86_64 ]; then sudo apt-get update; fi
  - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi

##
# Gradle

# newer version of gradle
wget http://services.gradle.org/distributions/gradle-1.11-bin.zip
unzip -qq gradle-1.11-bin.zip
export GRADLE_HOME=$PWD/gradle-1.11
export PATH=$GRADLE_HOME/bin:$PATH

# just to test gradle version, against our provided one
  - gradle -v

##
# Android SDK

# newest android SDK
  - wget http://dl.google.com/android/android-sdk_${ANDROID_SDK_VERSION}-linux.tgz
  - tar -zxf android-sdk_${ANDROID_SDK_VERSION}-linux.tgz
  - export ANDROID_HOME=`pwd`/android-sdk-linux
  - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

# manually set sdk.dir variable, according to local paths
  - echo "sdk.dir=$ANDROID_HOME" ]]> local.properties

##
# Android Components

# Install required components.
# For a full list, run `android list sdk -a --extended`
  - echo yes | android update sdk --filter platform-tools --no-ui --force ]]> /dev/null
  - echo yes | android update sdk --all --filter build-tools-19.0.3 --no-ui --force ]]> /dev/null
  - echo yes | android update sdk --filter android-19 --no-ui --force ]]> /dev/null
  - echo yes | android update sdk --filter extra-android-support --no-ui --force ]]> /dev/null
  - echo yes | android update sdk --filter extra-android-m2repository --no-ui --force ]]> /dev/null
  - echo yes | android update sdk --filter extra-google-m2repository --no-ui --force ]]> /dev/null

# for gradle output style
export TERM=dumb

# Create and start emulator
  - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &

install:
  - gradle check

after_install:

before_script:
  - chmod +x wait_for_emulator
  - ./wait_for_emulator

script:
  - sudo chmod +x gradlew
  - ./gradlew connectedCheck lint
  - ./gradlew connectedInstrumentTest

after_script:

after_success:
  - ./gradlew uploadArchives

after_failure:

wait_for_emulator

#!/bin/bash
bootanim=""
failcounter=0
until [[ "$bootanim" =~ "stopped" ]]; do
  bootanim=`adb -e shell getprop init.svc.bootanim 2>&1`
  echo "$bootanim"
  if [[ "$bootanim" =~ "not found" ]]; then
      let "failcounter += 1"
      if [[ $failcounter -gt 3 ]]; then
        echo "Failed to start emulator"
        exit 1
      fi
  fi
  sleep 10
done
echo “Done”

Travis CI - Free Hosted Continuous Integration Platform for the Open Source Community

Travis CI: Travis CI's use of GitHub API Scopes

Travis CI: How to skip a build

JakeWharton/sdk-manager-plugin · GitHub


Google Play Store に apk をアップロードできない

アプリを改修してアップデート公開しようとすると拒否られる.

AndroidStudio + Gradle の挙動が変わってる.

とりあえずは,

gradle clean

gradle assembleRelease

Generate Signed APK

でいける.


Google Analytics SDK v4 for Android を実装する

気がついたら v4.

Google_Analytics_SDK_v4_for_Android_-_Getting_Started_-_Google_アナリティクス_—_Google_Developers

実装してみる, と.

Google Analytics SDK v4 for Android - Getting Started - Google アナリティクス — Google Developers

読んで, さらっと, 箇条書き

・libs以下のjar不要. 「Google Play Service SDK」に含まれている
・Application 拡張クラスにTrackerメソッドを配置
・AndroidManifest.xml に Applicationクラス名記述
・設定はXMLファイルに記述

実際, やってみるといろいろあったのでメモ.

続きを読む >>