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
Add a comment  | 

1 Answer 1

Reset to default 2

Replace:

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.

本文标签: