Other

Android adbをWi-Fi接続

ケーブルをつないで、IPアドレスを調べる。


$ adb shell ipconfig
* daemon not running; starting now at tcp:5037
* daemon started successfully
/system/bin/sh: ipconfig: not found
RC211v-mbp:~ yuta$ adb shell ifconfig
lo        Link encap:UNSPEC  
          inet addr:127.0.0.1  Mask:255.0.0.0 
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1235 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:1235 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:0 
          RX bytes:111363 TX bytes:111363 

wlan0     Link encap:UNSPEC  
          inet addr:172.16.20.19  Bcast:172.16.255.255  Mask:255.255.0.0 

tcpip <任意のポート>


$ adb tcpip 12345
restarting in TCP mode port: 12345

connect <上記の任意のポート>


$ adb connect 172.16.20.19:12345
connected to 172.16.20.19:12345

USBケーブル、Wifiそれぞれで接続ができている。


$ adb devices
List of devices attached
172.16.20.19:12345  device
P3P7N17500000000    device

cordova-iconコマンドで”throw er; // Unhandled ‘error’ event”

Cordovaでリリースアプリのアイコンを一括登録しようと、npmのcordova-iconを使ったらエラーになった。


yuta$ cordova-icon --config=config.xml --icon=www/icon.png 

Checking Project & Icon

✓ platforms found: android
✓ www/icon.png exists
✓ config.xml exists

Generating Icons for android

events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn convert ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

image Magickインストールするの忘れてた。。


brew install imagemagick

Android APIよく忘れるのでメモ

Android 1.0 1 Base
Android 1.1 2 Base1.1
Android 1.5 3 Cupcake
Android 1.6 4 Donut
Android 2.0 5 Eclair
Android 2.0.1 6 Eclair 0.1
Android 2.1.x 7 Eclair mr1
Android 2.2.x 8 Froyo
Android 2.3 9 Gingerbread
Android 2.3.1
Android 2.3.2
Android 2.3.3 10 Gingerbread mr1
Android 2.3.4
Android 3.0.x 11 Honeycomb
Android 3.1.x 12 Honeycomb mr1
Android 3.2 13 Honeycomb mr2
Android 4.0 14 Ice Cream Sandwich
Android 4.0.1
Android 4.0.2
Android 4.0.3 15 Ice Cream Sandwich mr1
Android 4.1 16 Jelly Bean
Android 4.1.1
Android 4.2 17 Jelly Bean mr1
Android 4.2.2
Android 4.3 18 Jelly Bean mr2
Android 4.4 19 KitKat
Android 5.0 21 Lollipop
Android 5.1 22 ?
Android 6.0 23 Marshmallow
Android 7.0 24 Nougat
Android 8.0 26 Oreo

Android minSdkVersion の引き上げ

昔のアプリを久しぶりに修正しようと思ったら、minSdkVersionを引き上げる必要があった。

Error:Execution failed for task ':flatalk:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] /Users/admin/.android/build-cache/df7faf3c442bb6a7448aef64241ef184a528/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage

引用: 
https://developers-jp.googleblog.com/2016/12/google-play-services-and-firebase-for-android-will-support-api-level-14-at-minimum.html

次にリリースされる予定のバージョン 10.2.0 では、最小サポート API レベルが 9 から 14(Android 4.0.1、Ice Cream Sandwich)に引き上げられる予定です。この変更は、2017 年初めに実施される予定です。

Google Play サービスや Firebase を利用する Android アプリへの影響
バージョン 10.0.0 の Google Play サービスや Firebase は、現在と同様、問題なく利用できます。Gingerbread 端末でも今までと同様に動作します。
アプリの最小サポート API レベルが 14 以上(通常は、build.gradle の「minSdkVersion」で指定します)であれば、今後リリースされるバージョン 10.2.0 にアップグレードしてもバージョニングの問題は発生しません。しかし、API レベル 14 以下をサポートしているアプリの場合、ビルド時に次のようなエラーが表示されます。

Youtube API – ユーチューブのカテゴリを取得する( VideoCategories: list)


GET https://www.googleapis.com/youtube/v3/videoCategories

partのみ必須になっていたけど、regionCodeも必要だった。。今回はJPを指定。
参照:https://developers.google.com/youtube/v3/docs/videoCategories/list#try-it


{
"kind": "youtube#videoCategoryListResponse",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/siiWQ_WM0OtxtxK7NUUJKFwqDRc\"",
"items": [
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/Xy1mB4_yLrHy_BmKmPBggty2mZQ\"",
"id": "1",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Film & Animation",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/UZ1oLIIz2dxIhO45ZTFR3a3NyTA\"",
"id": "2",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Autos & Vehicles",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/nqRIq97-xe5XRZTxbknKFVe5Lmg\"",
"id": "10",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Music",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/HwXKamM1Q20q9BN-oBJavSGkfDI\"",
"id": "15",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Pets & Animals",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/9GQMSRjrZdHeb1OEM1XVQ9zbGec\"",
"id": "17",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Sports",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/FJwVpGCVZ1yiJrqZbpqe68Sy_OE\"",
"id": "18",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Short Movies",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/M-3iD9dwK7YJCafRf_DkLN8CouA\"",
"id": "19",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Travel & Events",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/WmA0qYEfjWsAoyJFSw2zinhn2wM\"",
"id": "20",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Gaming",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/EapFaGYG7K0StIXVf8aba249tdM\"",
"id": "21",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Videoblogging",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/xId8RX7vRN8rqkbYZbNIytUQDRo\"",
"id": "22",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "People & Blogs",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/G9LHzQmx44rX2S5yaga_Aqtwz8M\"",
"id": "23",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Comedy",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/UVB9oxX2Bvqa_w_y3vXSLVK5E_s\"",
"id": "24",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Entertainment",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QiLK0ZIrFoORdk_g2l_XR_ECjDc\"",
"id": "25",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "News & Politics",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/r6Ck6Z0_L0rG37VJQR200SGNA_w\"",
"id": "26",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Howto & Style",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/EoYkczo9I3RCf96RveKTOgOPkUM\"",
"id": "27",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Education",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/w5HjcTD82G_XA3xBctS30zS-JpQ\"",
"id": "28",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Science & Technology",
"assignable": true
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/lL7uWDr_071CHxifjYG1tJrp4Uo\"",
"id": "30",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Movies",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/WnuVfjO-PyFLO7NTRQIbrGE62nk\"",
"id": "31",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Anime/Animation",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/ctpH2hGA_UZ3volJT_FTlOg9M00\"",
"id": "32",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Action/Adventure",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/L0kR3-g1BAo5UD1PLVbQ7LkkDtQ\"",
"id": "33",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Classics",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/pUZOAC_s9sfiwar639qr_wAB-aI\"",
"id": "34",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Comedy",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/Xb5JLhtyNRN3AQq021Ds-OV50Jk\"",
"id": "35",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Documentary",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/u8WXzF4HIhtEi805__sqjuA4lEk\"",
"id": "36",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Drama",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/D04PP4Gr7wc4IV_O9G66Z4A8KWQ\"",
"id": "37",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Family",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/i5-_AceGXQCEEMWU0V8CcQm_vLQ\"",
"id": "38",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Foreign",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/rtlxd0zOixA9QHdIZB26-St5qgQ\"",
"id": "39",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Horror",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/N1TrDFLRppxZgBowCJfJCvh0Dpg\"",
"id": "40",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Sci-Fi/Fantasy",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/7UMGi6zRySqXopr_rv4sZq6Za2E\"",
"id": "41",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Thriller",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/RScXhi324h8usyIetreAVb-uKeM\"",
"id": "42",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Shorts",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/0n9MJVCDLpA8q7aiGVrFsuFsd0A\"",
"id": "43",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Shows",
"assignable": false
}
},
{
"kind": "youtube#videoCategory",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/x5NxSf5fz8hn4loSN4rvhwzD_pY\"",
"id": "44",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Trailers",
"assignable": false
}
}
]
}

Cordova Plugin作成 ( plugin.xml記載ミスでassets全部消えた。。)

<resource-file src=”res/assets/cordova-plugin-4assets.js” target=”assets” />

target-dirとtargetを記載ミスしてました。

正しくは、

<resource-file src=”res/assets/cordova-plugin-4assets.js” target=”assets/cordova-plugin-4assets.js” />

<resource-file src=”res/assets/cordova-plugin-4assets.js” target-dir=”assets/” />

プラグイン削除時にtargetも消されるので、assetsごと消されました。

(TensorFlow + keras ) Epoch 50/50 終わったと思ったら。。ImportError: `save_model` requires h5py.


2000/2000 [==============================] - 396s - loss: 1.1921e-07 - acc: 1.0000 - val_loss: 1.1921e-07 - val_acc: 1.0000
Traceback (most recent call last):File "image_classify.py", line 24, in <module>
model.save("image_classifier.h5")
    File "/usr/local/lib/python2.7/site-packages/keras/engine/topology.py", line 2553, in save
    save_model(self, filepath, overwrite, include_optimizer)
  File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 56, in save_model
    raise ImportError('`save_model` requires h5py.')
ImportError: `save_model` requires h5py.
mbp:sd201708_sp1_ch02_sample_rev1 dp$


pip install h5py

cordova-splashはcordovaのスプラッシュを一括で作成するnpmパッケージ

cordovaのスプラッシュを一括で作成するnpmパッケージ

https://www.npmjs.com/package/ 

[code language=”bash”]
sudo npm install cordova-splash -g
[/code]

[code language=”bash”]
cordova-splash –config=config.xml –splash=images/002.splash-screen.png

Checking Project & Splash

✓ platforms found: android
✓ images/002.splash-screen.png exists
✓ config.xml exists

Generating splash screen for android

resize arg
arg 320×200
resize arg
arg 480×320
resize arg
arg 800×480
resize arg
arg 1280×720
resize arg
arg 1920×1280
resize arg
arg 1600×960
resize arg
arg 320×480
resize arg
arg 200×320
resize arg
arg 480×800
resize arg
arg 720×1280
resize arg
arg 960×1600
resize arg
arg 1280×1920
✓ drawable-land-ldpi/screen.png created
✓ drawable-land-mdpi/screen.png created
✓ drawable-port-ldpi/screen.png created
✓ drawable-port-mdpi/screen.png created
✓ drawable-port-hdpi/screen.png created
✓ drawable-land-hdpi/screen.png created
✓ drawable-port-xhdpi/screen.png created
✓ drawable-land-xhdpi/screen.png created
✓ drawable-port-xxhdpi/screen.png created
✓ drawable-port-xxxhdpi/screen.png created
✓ drawable-land-xxhdpi/screen.png created
✓ drawable-land-xxxhdpi/screen.png created

[/code]

‘cordova-plugin-livereload’ has been deprecated!!!

cordovaのplatform addはdeprecatedで停止しても、runできてしまった。

deprecatedだけ除外したのかとおもったら

cordovaのアプリがネットワークに繋がらなかったり、プラグインが動かなくなったので

AndroidManifest.xmlをみるとuses-permissionもactivityも全然足りていない。。

deprecatedの対象cordova-plugin-livereloadを除外して、platform rm addを再度行ってみたら治った。

 

Installing “cordova-plugin-headercolor” for android

Installing “cordova-plugin-inappbrowser” for android

Installing “cordova-plugin-livereload” for android
##################################################################

‘cordova-plugin-livereload’ has been deprecated!!!

Please use ‘taco run –livereload’ instead.

For more information please visit http://taco.tools/docs/run.html.

##################################################################
Failed to install ‘cordova-plugin-livereload’: Error: Deprecated Plugin ‘cordova-plugin-livereload’

Error: Deprecated Plugin ‘cordova-plugin-livereload’

CordovaアプリのGooglePlay向けリリース準備

cordova-splash –config=config.xml –splash=splash-screen.png

cordova-icon –icon=ic_launcher-web.png

cordova build android —release

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore {KeyStoeFilePath} platforms/android/build/outputs/apk/{ApkFileName}  {KeyStoreAliasName} 

zipalign -f -v 4 platforms/android/build/outputs/apk/{ApkFileName} platforms/android/build/outputs/apk/{outputApkFileName}