guava が 21.0 で Error:Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code.

ライブラリ群を更新していると

あやしい Project Structure ダイアログを Experimental にしてライブラリ更新を正しく把握する

ビルドできない...


Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.

gradleコンソールを眺めていると以下を発見.


com/google/common/io/InsecureRecursiveDeleteException references unknown class: java/nio/file/FileSystemException

下げます guava.


//compile 'com.google.guava:guava:21.0'
compile 'com.google.guava:guava:20.0'

いけた.

Java7向けのセットが残ってるんかな.

Issues · google/guava

java - Android: Dex cannot parse version 52 byte code - Stack Overflow


新しくなった Android Asset Studio でマテリアルアイコンを自在に加工するべし

作者の Roman Nurik さんがつぶやいています.

使ってみましょう.

Android Asset Studio

Google から公開されているマテリアルデザインのアイコンを元に色やサイズやエフェクトをお好みにブラウザ上で設定してダウンロードできます.

編集後は, resディレクトリ以下解像度別のディレクトリの構造に合わせて作成されたzipアーカイブをダウンロードできます.


$ zipinfo -1 ic_launcher.zip
res/mipmap-xxxhdpi/ic_launcher.png
web_hi_res_512.png
res/mipmap-xxhdpi/ic_launcher.png
res/mipmap-xhdpi/ic_launcher.png
res/mipmap-hdpi/ic_launcher.png
res/mipmap-mdpi/ic_launcher.png


$ zipinfo -v ic_launcher.zip
Archive:  ic_launcher.zip
There is no zipfile comment.

End-of-central-directory record:
-------------------------------

  Zip archive file size:                    129862 (000000000001FB46h)
  Actual end-cent-dir record offset:        129840 (000000000001FB30h)
  Expected end-cent-dir record offset:      129840 (000000000001FB30h)
  (based on the length of the central directory and its expected offset)

  This zipfile constitutes the sole disk of a single-part archive; its
  central directory contains 6 entries.
  The central directory is 455 (00000000000001C7h) bytes long,
  and its (expected) offset in bytes from the beginning of the zipfile
  is 129385 (000000000001F969h).


Central directory entry #1:
---------------------------

  res/mipmap-xxxhdpi/ic_launcher.png

  offset of local header from start of archive:   0
                                                  (0000000000000000h) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         5e505e31
  compressed size:                                20038 bytes
  uncompressed size:                              20028 bytes
  length of filename:                             34 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

  There is no file comment.

Central directory entry #2:
---------------------------

  There are an extra 16 bytes preceding this file.

  web_hi_res_512.png

  offset of local header from start of archive:   20118
                                                  (0000000000004E96h) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         bb74dba5
  compressed size:                                74680 bytes
  uncompressed size:                              75392 bytes
  length of filename:                             18 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

  There is no file comment.

Central directory entry #3:
---------------------------

  There are an extra 16 bytes preceding this file.

  res/mipmap-xxhdpi/ic_launcher.png

  offset of local header from start of archive:   94862
                                                  (000000000001728Eh) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         ca100bd5
  compressed size:                                15772 bytes
  uncompressed size:                              15790 bytes
  length of filename:                             33 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

  There is no file comment.

Central directory entry #4:
---------------------------

  There are an extra 16 bytes preceding this file.

  res/mipmap-xhdpi/ic_launcher.png

  offset of local header from start of archive:   110713
                                                  (000000000001B079h) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         6551b330
  compressed size:                                8409 bytes
  uncompressed size:                              8404 bytes
  length of filename:                             32 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

  There is no file comment.

Central directory entry #5:
---------------------------

  There are an extra 16 bytes preceding this file.

  res/mipmap-hdpi/ic_launcher.png

  offset of local header from start of archive:   119200
                                                  (000000000001D1A0h) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         44371c4a
  compressed size:                                6539 bytes
  uncompressed size:                              6534 bytes
  length of filename:                             31 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

  There is no file comment.

Central directory entry #6:
---------------------------

  There are an extra 16 bytes preceding this file.

  res/mipmap-mdpi/ic_launcher.png

  offset of local header from start of archive:   125816
                                                  (000000000001EB78h) bytes
  file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
  version of encoding software:                   2.0
  minimum file system compatibility required:     MS-DOS, OS/2 or NT FAT
  minimum software version required to extract:   2.0
  compression method:                             deflated
  compression sub-type (deflation):               normal
  file security status:                           not encrypted
  extended local header:                          yes
  file last modified on (DOS date/time):          2017 Jan 18 12:53:42
  32-bit CRC value (hex):                         4fce9139
  compressed size:                                3492 bytes
  uncompressed size:                              3487 bytes
  length of filename:                             31 characters
  length of extra field:                          0 bytes
  length of file comment:                         0 characters
  disk number on which file begins:               disk 1
  apparent file type:                             binary
  non-MSDOS external file attributes:             000000 hex
  MS-DOS file attributes (00 hex):                none

かんたんなアイコンであれば簡単に素早く作成できます.

Windows版デスクトップアプリ(.exe形式)もある模様.

romannurik/AndroidAssetStudio: A set of web-based tools for generating graphics and other assets that would eventually be in an Android application's res/ directory.


Android 6.x (Marshmallow) ホーム長押し (アシスト機能) アプリの設定

ホームボタンを長押しするとアプリが起動するようになったりしています.

ここから起動できるアプリを変更してみます.

OSバージョンで異なるようですが, 今回は, Android OS 6.x でやってみます.

[設定] - [アプリ] とタップしていきます.

ここで, 右上の「歯車」ボタンをタップします.

そして「既定のアプリ」をタップします.

一番上の「アシストと音声入力」をタップ.

さらに, 一番上の「アシストアプリ」の表示されてる文字の部分(歯車ではない) を押します.

この画面では現在「Launcher3」というアプリがセットされていますので. 歯車を押すとそのアプリの設定画面が表示されます. ホームボタン長押しから利用するアプリ自体を変更する場合は文字の部分をタップします.

インストールしているアプリのうち, アシスト機能に対応しているアプリの一覧が表示されますので, 利用したいアプリをタップしてセットします.

例えば「なし」を選択すると, ホームボタンを長押ししたときの反応はなくなります.

正直, 最近のOSまわりの設定は複雑すぎじゃない?

ホームボタン長押しアプリの変更や削除する方法

【3年連続3回目】ホームボタン長押し から起動されるアプリの変更は「アシス」で