admin管理员组文章数量:1332339
Attempting dev of simple (personal use) Android/Kotlin app. ie. enter single data field, then send to mobile printer as simple label. Novice to Android programming however programmer in previous life and tinkerer (Im 81 so prior to object oriented). Have my very simple XML UI looking fine. Now attempting to develop Kotlin code. In addition to user typing into single EditText field, I wish to implement barcode scanning of the data. Google Code Scanner seems to be the suggested approach so following the only example I could find (ML Kit example), I get to this point (see attached screen shot) with odd error. What am I missing? Also noted that targetSDK = 34 is highlighted in yellow
Attempting dev of simple (personal use) Android/Kotlin app. ie. enter single data field, then send to mobile printer as simple label. Novice to Android programming however programmer in previous life and tinkerer (Im 81 so prior to object oriented). Have my very simple XML UI looking fine. Now attempting to develop Kotlin code. In addition to user typing into single EditText field, I wish to implement barcode scanning of the data. Google Code Scanner seems to be the suggested approach so following the only example I could find (ML Kit example), I get to this point (see attached screen shot) with odd error. What am I missing? Also noted that targetSDK = 34 is highlighted in yellow
Share Improve this question asked Nov 20, 2024 at 20:23 BruceBruce 175 bronze badges 1- 1 In the future, please post text as text, not as screenshots. – CommonsWare Commented Nov 20, 2024 at 20:25
1 Answer
Reset to default 2Replace:
implementation 'com.google.android.gms:play-services-code-scanner:16.0.1'
with:
implementation("com.google.android.gms:play-services-code-scanner:16.0.1")
This adds the parentheses and replaces the single quote delimiters with double quotes.
My guess is that you copied and pasted the first implementation
line from somewhere. That example was for Gradle scripts written in Groovy (build.gradle
). Your Gradle script is written in Kotlin (build.gradle.kts
). Your script is the more modern approach, but it does mean that from time to time you will need to convert Groovy syntax in examples to Kotlin syntax.
本文标签:
版权声明:本文标题:kotlin - Attempting to add Google Code Scanner to simple android app. Only example I've seen is ML Kit sample - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742331102a2454712.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论