0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Built-in Shrinkerがproguard-rulesのパースに失敗する

Last updated at Posted at 2018-08-29

※ Built-in Shrinkerは、Android Gradle Plugin 3.3からR8に置き換わりました。

問題

Built-in Shrinkerを有効にしてビルドしたときになぜか

> ProGuard configuration parser error: ~\app\proguard-rules.pro line 35:21 no viable alternative at input ','

こんなビルドエラーが表示されました。
useProguard trueは問題ないので、proguard-rulesの記述は間違っていないはず…

ちなみに発生環境はAndroid Studio 3.1.4です。
(この問題自体をShrinkerを諦めることで長らく放置してたので、3.1.0でも起きると思います。)

なおった

結論だけ言うと、proguard定義の

-keepmembernames,allowobfuscation

はダメで

-keepmembers,allowshrinking,allowobfuscation

なら通ります。

, is 何?」みたいなパースエラーが吐かれますが、嘘です。
allowshrinkingオプションを省略記述にした上でallowobfuscationオプションを使うとエラーになります。1

僕の場合、ライブラリが公開しているproguard定義をそのまま書いたら、この記述を使っていてShrinkerがエラーになっていました。

  1. -keep*names-keep*s,allowshrinkingの省略です。-keepmembernames-keepmembers,allowshrinkingの省略にあたります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?