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ファイルに記述

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

続きを読む >>


パソコン上で Android を試せる「Genymotion」で GooglePlayStore を使う

公式エミュレータとの比較になるのだけれども。

Genymotion

デメリット

・Geniymotionにアカウント登録が必要。
ダウンロード時、メールアドレス等の登録が必要。

・VirtualBox のインストールが必須。
ダウンロード後、ダブルクリックでインストール完了。

・起動できないアプリもある。
DRMとか課金系とか、厳しいアプリは起動できないように思える。

・動画が見れない。

メリット

・サクサク快適。

起動が早い。低スペックなマシンでは動かなかったNexus10も軽快にうごく。

・インストール、設定が簡単。

公式では、同じ kitkat(API19)でも、intelx86 とか、arm とか、snapshot が、とかあるけども簡単に avd の作成ができる。
対応機種は少ないが機種名から、その機種の最新のOSバージョンが設定されるので便利。例えば、Nexus S なら 2.3.7 とか。
Kitkatならカラー絵文字もフツーに表示されるし、表示サイズもパソコンディスプレイサイズに合わせて表示されている。

・Google Play Store が利用できる。

arm コンバータと、gapps のzipアーカイブをGUI上にドラッグアンドドロップするだけでフラッシュまで完了できる。楽ちん。
ストア上の掲載情報や公開されているapkを実際にインストールできるので間違いがない。

・文字入力、カーソルキーで画面遷移や操作ができる。

結構でかい。パソコンで矢印(ポインタ)を移動させながらのドラッグとかスワイプほどダルい操作はない。

なんせ、動作がキビキビで快速なのが最大のメリット。デフォルト設定でこの快適感。インストールから起動までの作業時間もほんの数分。

ちと、Chromeが不安定に思えるのだがまあいいか。

AndroidStudioプラグインもあるよ。

JetBrains Plugin Repository :: Genymotion

jenkins に。

Use Genymotion with Jenkins for Android testing | Genymobile Blog

で、これって、Googleアカウントがあれば、パソコン上で、Androidを*ある程度*お試しできるよなあ、と。

続きを読む >>


「UnsupportedOperationException: isDirectory is not implemented: isDirectory is not implemented」といってファイルを作成させない AndroidStudio 0.5.1

テストコードなど新規につくろうとしたら!

UnsupportedOperationException: isDirectory is not implemented: isDirectory is not implemented

なんなんすか、これは。

これのようです。

Issue 66818 - android - Error After upgrade to 0.5.0: UnsupportedOperationException while creating new file - Android Open Source Project - Issue Tracker - Google Project Hosting

結局、今できる解決法としては、

This is a bug in IntelliJ which was merged into the subsequent EAP build. It'll be available in AS 0.5.2.

Until then, the workaround is to copy over an existing file.

https://android-review.googlesource.com/#/c/85464/

以下から「コピーして上書きしろ」ということです。

Change I7557101c: Fix for IDEA-121307 Cannot create new file (StubVirtualFile throws an exception on isDirectory) | android-review.googlesource Code Review

Change_I7557101c__Fix_for_IDEA-121307_Cannot_create_new_file__StubVirtualFile_throws_an_exception_on_isDirectory____android-review_googlesource_Code_Review

えええ、どうしたらいいのー?

。。。

と思っていたらプラグイン形式で配布してる人いました。

続きを読む >>