title | emoji | type | topics | published | publication_name | |||
---|---|---|---|---|---|---|---|---|
Android で QR コードスキャンを実装する |
📷 |
tech |
|
true |
yumemi_inc |
Android で QR コードスキャンを実装するのに code-scanner を利用します。README の通りの手順ではうまくいかないので Workaround の記録です。
README には以下のように記載されていますが、まだ反映されていないのか、 Failed to resolve: com.github.yuriy-budiyev:code-scanner:2.1.0
となって失敗します。
dependencies {
implementation 'com.github.yuriy-budiyev:code-scanner:2.1.0'
}
変更前の URL を指定すると取得可能です。
dependencies {
- implementation 'com.github.yuriy-budiyev:code-scanner:2.1.0'
+ implementation 'com.budiyev.android:code-scanner:2.1.0'
}
この変更は以下の Pull Request で直近発生していたのでまだ反映されていなくて、直に反映される解消される可能性があります。
yuriy-budiyev/code-scanner#140
別のデモプロジェクトにあるように API 23 以上ではカメラパーミッションの許可を求める必要があります。
最終的に動作を確認できた状態を以下のリポジトリに反映しました。
https://github.com/ykws/code-scanner-example
以下の QR コード生成サイトで FREE TEXT に code-scanner-example
と入力します。
https://www.the-qrcode-generator.com/
生成された QR コードをスキャンした結果のスクリーンショットです。
![](https://storage.googleapis.com/zenn-user-upload/010ca5afdc26-20220210.png =200x)