Error Conflict with dependency com.android.support support-annotations

Android

違う担当者のPCのAndroid Studioで、同じプロジェクトを読み込もうとしたところ、下記のエラーが出て、どうしてもビルドできませんでした。

Error:Conflict with dependency ‘com.android.support:support-annotations’. Resolved versions for app (23.0.0) and test app (23.1.1) differ.

ちなみに、問題のあったappのbuild.gradleは次のような感じ

下記のようなサイトを見て、

http://stackoverflow.com/questions/36833606/android-support-library-error-after-updating-to-23-3-0

 androidTestCompile 'com.android.support:support-annotations:23.0.1'

 androidTestCompile 'com.android.support:support-annotations:23.1.1'

に直して、Syncをやり直しても、どうにも同じエラーしか出ません。。。

♪なんでんなんでんなんでやねんねんねん!

そこで、stack oveflowさんの記事で、dependencyを調べてみよ!というアドバイスもありましたので、なんかイヤだな~と思いながらやってみます。

Android StudioのTerminal から

 gradlew -q app:dependencies

とやります。
すると、下記のようにdependencyがわーっと出てきます。ひゃっほーい!!

 Microsoft Windows [Version 10.0.10586]
 (c) 2015 Microsoft Corporation. All rights reserved.
 
 C:\Android\hogehoge>gradlew :app:dependencies
 Incremental java compilation is an incubating feature.                           
 WARNING: Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.0.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
 :app:dependencies                
                                  
 ------------------------------------------------------------
 Project :app                     
 ------------------------------------------------------------
                                 
 _debugAndroidTestApk - ## Internal use, do not manually configure ##
 +--- com.android.support:support-annotations:23.0.1 -> 23.1.1
 +--- com.android.support.test:runner:0.5
 |    +--- com.android.support:support-annotations:23.1.1
 |    +--- junit:junit:4.12       
 |    |    \--- org.hamcrest:hamcrest-core:1.3
 |    \--- com.android.support.test:exposed-instrumentation-api-publish:0.5
 +--- com.android.support.test:rules:0.5
 |    \--- com.android.support.test:runner:0.5 (*)
 +--- org.hamcrest:hamcrest-library:1.3
 |    \--- org.hamcrest:hamcrest-core:1.3
 +--- com.android.support.test.espresso:espresso-core:2.2.2
 |    +--- com.squareup:javawriter:2.1.1
 |    +--- com.android.support.test:rules:0.5 (*)
 |    +--- com.android.support.test:runner:0.5 (*)
 |    +--- javax.inject:javax.inject:1
 |    +--- org.hamcrest:hamcrest-library:1.3 (*)
 |    +--- com.android.support.test.espresso:espresso-idling-resource:2.2.2
 |    +--- org.hamcrest:hamcrest-integration:1.3
 |    |    \--- org.hamcrest:hamcrest-library:1.3 (*)
 |    +--- com.google.code.findbugs:jsr305:2.0.1
 |    \--- javax.annotation:javax.annotation-api:1.2
 +--- com.android.support.test.uiautomator:uiautomator-v18:2.1.1
 \--- com.android.support.test.espresso:espresso-intents:2.2.2
     \--- com.android.support.test.espresso:espresso-core:2.2.2 (*)
                                 
 _debugAndroidTestCompile - ## Internal use, do not manually configure ##
 +--- com.android.support:support-annotations:23.0.1 -> 23.1.1
 +--- com.android.support.test:runner:0.5
 |    +--- com.android.support:support-annotations:23.1.1
 |    +--- junit:junit:4.12       
 |    |    \--- org.hamcrest:hamcrest-core:1.3
 |    \--- com.android.support.test:exposed-instrumentation-api-publish:0.5
 +--- com.android.support.test:rules:0.5
 |    \--- com.android.support.test:runner:0.5 (*)
 +--- org.hamcrest:hamcrest-library:1.3
 |    \--- org.hamcrest:hamcrest-core:1.3
 +--- com.android.support.test.espresso:espresso-core:2.2.2
 |    +--- com.squareup:javawriter:2.1.1
 |    +--- com.android.support.test:rules:0.5 (*)
 |    +--- com.android.support.test:runner:0.5 (*)
 |    +--- javax.inject:javax.inject:1
 |    +--- org.hamcrest:hamcrest-library:1.3 (*)
 |    +--- com.android.support.test.espresso:espresso-idling-resource:2.2.2
 |    +--- org.hamcrest:hamcrest-integration:1.3
 |    |    \--- org.hamcrest:hamcrest-library:1.3 (*)
 |    +--- com.google.code.findbugs:jsr305:2.0.1
 |    \--- javax.annotation:javax.annotation-api:1.2
 +--- com.android.support.test.uiautomator:uiautomator-v18:2.1.1
 \--- com.android.support.test.espresso:espresso-intents:2.2.2
      \--- com.android.support.test.espresso:espresso-core:2.2.2 (*)
                                 
 _debugApk - ## Internal use, do not manually configure ##
 +--- com.facebook.android:facebook-android-sdk:4.6.0
 |    +--- com.parse.bolts:bolts-android:1.2.0
 |    \--- com.android.support:support-v4:[22,23) -> 23.0.0
 |         \--- com.android.support:support-annotations:23.0.0
 +--- com.google.android.gms:play-services-gcm:8.4.0
 |    +--- com.google.android.gms:play-services-base:8.4.0
 |    |    \--- com.google.android.gms:play-services-basement:8.4.0
 |    |         \--- com.android.support:support-v4:23.0.0 (*)
 |    \--- com.google.android.gms:play-services-measurement:8.4.0
 |         \--- com.google.android.gms:play-services-basement:8.4.0 (*)
 +--- org.apache.httpcomponents:httpcore:4.4.1
 +--- com.android.support.test.espresso:espresso-idling-resource:2.2.2
 \--- com.google.android.gms:play-services-measurement:8.4.0 (*)
                                 
 _debugCompile - ## Internal use, do not manually configure ##
 +--- com.facebook.android:facebook-android-sdk:4.6.0
 |    +--- com.parse.bolts:bolts-android:1.2.0
 |    \--- com.android.support:support-v4:[22,23) -> 23.0.0
 |         \--- com.android.support:support-annotations:23.0.0
 +--- com.google.android.gms:play-services-gcm:8.4.0
 |    +--- com.google.android.gms:play-services-base:8.4.0
 |    |    \--- com.google.android.gms:play-services-basement:8.4.0
 |    |         \--- com.android.support:support-v4:23.0.0 (*)
 |    \--- com.google.android.gms:play-services-measurement:8.4.0
 |         \--- com.google.android.gms:play-services-basement:8.4.0 (*)
 +--- org.apache.httpcomponents:httpcore:4.4.1
 +--- com.android.support.test.espresso:espresso-idling-resource:2.2.2
 \--- com.google.android.gms:play-services-measurement:8.4.0 (*)
                                  
 //あとは略

そう、謎は解けまして、

 +--- com.facebook.android:facebook-android-sdk:4.6.0
 |    +--- com.parse.bolts:bolts-android:1.2.0
 |    \--- com.android.support:support-v4:[22,23) -> 23.0.0
 |         \--- com.android.support:support-annotations:23.0.0

でFacebookのライブラリが、com.android.support:support-annotations:23.0.0を使ってるんですね!

なるー…。

Facebookのライブラリの指定を

 compile 'com.facebook.android:facebook-android-sdk:4.+'

に変更しsupport-annotationsも下記のように

 androidTestCompile 'com.android.support:support-annotations:23.4.0'

で、解決できました!

やはり、みなさんがやった方がいいということはやった方がいい、という教訓ですね[smile]

Ecxel キーボードでセルの移動ができない

Office2007
Ecxel2007

Ecxel キーボードでセルの移動ができない

Excelを動かしていて、キーボードの上、下、右、左でセルの移動ができなくなることがあります。
マウスやEnterでは移動できるのに…

そういうときは、Scroll lockが押されている可能性があります。

Scroll lockと書かれたキー、あるいは「ScrLK」と書かれたキーを一回たたいてください。
それで治ります。

Eclipse 差分チェック

PHP

Eclipseを使って2つのファイルの差分を比較する

  1. 左のエクスプローラーのベインで、比較したい2つのファイルを同時にCtrlなどを押しながら選択
  2. 右クリックをして、「比較→相互」をクリック

Eclipse+xdebugでcakephpをリモートデバッグする

Eclipse

Windows7+EclipseからLinuxサーバー上のCakePHPアプリをリモートデバッグする方法です。

以下の環境で動作確認しています。

  • 開発クライアントPC

Windows7
Eclipse for PHP Developers Version:3.0.2(Indigo)

  • 開発サーバー

CentOS 6.2
PHP 5.3
xdebug 2.1.4

開発Webサーバー(CentOS)

 # yum install php-pecl-xdebug

/etc/php.d/xdebug.ini

 ; Enable xdebug extension module
 zend_extension=/usr/lib64/php/modules/xdebug.so
 xdebug.remote_enable=1
 xdebug.remote_connect_back=1
 ;xdebug.remote_log="/tmp/xdebug_log"

xdebug.remote_connect_back=1とすると、任意のPCからリモートデバッグできるようになります。
xdebug.remote_logでログファイルのパスを指定するとxdebugのログが出力されます。リモートデバッグがうまく動作しないときに参考になります。
なお、上記のxdebug.iniはリモートデバッグするのに必要最低限の設定です。
必要に応じて他の項目を指定してください。

Eclipse

Window -> Preferences

Eclipse全体の設定です。

PHP -> Executables

Windows7側にインストールしたphp.exeのパスを指定します。
xampp等を使うのがお手軽です。

PHP -> PHP Servers

  • Server

Base URL: 開発Webサーバー側のベースURL
Local Web Root: 開発WebサーバーのBase URLに対応するクライアントPC側の物理パス

  • Path Mapping

Path on Server: 開発Webサーバー上の物理パス
Path in Workspace: クライアントPC上の物理パス
(WorkspaceまたはFileSystemのいずれかで指定します)

デバッグ設定

Debug Configurationsから設定します。

  • Server

Server Debugger: “XDebug”
PHP Server: PHP Serversで設定済みのものから選択します
File: クライアントPC側のapp/webroot/index.phpを指定します。
※cakephpルート直下のindex.phpを指定するとrequireが正しく処理されません。
URL: Auto Generateで問題がある場合は、上のFile項目で指定したパスに相当する開発Webサーバー側のURLを指定します。

Eclipse(Java版) インストールした場所を確認する方法

Eclipse

Eclipse インストールした場所を確認する方法

「久々にAndroidでの開発を行おうと、ADTをインストールして、既存のインストールしてあるフォルダに入れようとしたが、インストールした場所が思い出せない!!」なんていうことはありませんでしたか?
しかし、eclipse.phpは、デスクトップ下のタスクバーにはあったので、なんとか開けるという場合の対処法です。

①Androidの開発環境のeclipse.phpを開く。
②左上「File」⇒「Properties」を開き、サイドバー、「Resources」を選択し、その「Location」部分にインストールしてあるフォルダがあります。