パソコン上で 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を*ある程度*お試しできるよなあ、と。

続きを読む >>


ADT 22.6.0 となり Java7 で AndroidStudio をば。

こう書いてあるけど。

ADT 22.6.0 (March 2014)
・・・
Added support for Java 7 language features like multi-catch, try-with-resources, and the diamond operator. These features require version 19 or higher of the Build Tools. Try-with-resources requires minSdkVersion 19; the rest of the new language features require minSdkVersion 8 or higher.
・・・

ADT Plugin | Android Developers

以下のような状態だと。

o multi-catch
x try-with-resources
o diamond operator
o strings in switches

try-with-resource(リソース付きtry/勝手にclose) のみAPI19以降。

try (FileInputStream input = new FileInputStream("file.txt")) {
  int data = input.read();
  while(data != -1){
    System.out.print((char) data);
    data = input.read();
  }
}

なので、もうあげちゃいます Java6 から java7 へ。

続きを読む >>


AndroidStudio 0.5.1 リリース版ビルドで「Lint found fatal errors while assembling a release target.」

リリース版をビルドしていたら
こんなのでました。

Error:Gradle: Execution failed for task ':sample:lintVitalRelease'.
> Lint found fatal errors while assembling a release target.

gradle

。。。

lint に対してコードを修正していくのもアレなので以下を build.gradle に。

android {
  lintOptions {
    checkReleaseBuilds false
    abortOnError false
}

エラーメッセージの言う通りにすれば通るのだけれども、
なんだかな。

しかし、lint っていつもこんなかんじな扱いを受けてるよねー。


Google Interstitial(インタースティシャル)広告の今どきの実装方法はどこに

さあ、そんな広告を実装しようと思いました。

Interstitials_-_Google_Mobile_Ads_SDK_—_Google_Developers

とりあえず、ぐぐろうとします。

頭悪いので、そこでまず悩みます。

「Google」なのか「Admob」なのか

「インタースティシャル」なのか「インターステイシャル」なのか

「interstatial」なのか「interstitial」なのか

「GooglePlaySDK(gms)」同梱なのか、別SDKなのか。

とりあえず、こんなこまかいことは Google検索に考えてもらうとして

これら単語をやみくもに入力、検索して実装説明方法を探します。

それらしいのがみつかりました。

import com.google.android.gms.ads.doubleclick.*;

public class InterstitialExample extends Activity {

  private PublisherInterstitialAd interstitial;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Create the interstitial.
    interstitial = new PublisherInterstitialAd(this);
    interstitial.setAdUnitId(MY_AD_UNIT_ID);

    // Create ad request.
    PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build();

    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);

  }

  // Invoke displayInterstitial() when you are ready to display an interstitial.
  public void displayInterstitial() {
    if (interstitial.isLoaded()) {
      interstitial.show();
    }
  }
}

DoubleClick for Publishers (DFP) Interstitial Ads - Google Mobile Ads SDK — Google Developers

が、動きません。Admobの上位の「DFP」なるしくみのようです。

で次。

import com.google.ads.*;

public class BannerExample extends Activity {
  private InterstitialAd interstitial;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // インタースティシャルを作成する
    interstitial = new InterstitialAd(this, MY_INTERSTITIAL_UNIT_ID);

    // 広告リクエストを作成する
    AdRequest adRequest = new AdRequest();
    // インタースティシャルの読み込みを開始する
    interstitial.loadAd(adRequest);
  }
}

Google AdMob Ads Android(上級) - Google Mobile Ads SDK — Google Developers

これもダメです。

最新の「GooglePlay SDK(gms)」の実装ではなく、古いAdmobSDKの実装方法のようです。

で、次。

続きを読む >>


Mac OSX 10.9 Mavericks で「ログイン項目」が保存されず消える場合2

OKなように見えたが。以前の方法で。

Mac OSX 10.9 Mavericks で「ログイン項目」が保存されず消える場合

また、消えてる。

10.9で色々やってて、少しわかってきたけど、どうやら、
Preferences 内の plist を削除しても作成されるときには
前の設定が復活するみたいだ
移動か削除されるときにでもどこかにバックアップされている様子

アプリとか初期状態にしようとして削除しても出来ない仕様になったのかこれ
調子が悪くてplist削除で直るとかそういうのは簡単には出来なくなったよ
いくら消しても改善しない人はこれが原因かも

Developer_Forums__NSUserdefaults_not_saving_preferences_for_some_users_on_Mavericks

10. Re: NSUserdefaults not saving preferences for some users on Mavericks
In response to gw1921 on Oct 21, 2013 4:52 PM
There's two ways to get back to working properly (assuming that's the issue, anyway 🙂 ):

1) Log out or reboot

or

2) 'killall -SIGTERM cfprefsd'

Naturally the latter isn't particularly guaranteed, but with the current implementation it will do the trick.

Developer Forums: NSUserdefaults not saving preferences for some users on Mavericks

これで再び様子をみる。と。

(つづく)