Skip to content

Build Error in android: Only safe (?.) or non-null asserted (!!.)...Β #228

@roysG

Description

@roysG

Steps to reproduce the behavior:

  1. Run npx react-native run-android
  2. See error

(base) roysabah@Roys-MacBook-Pro-2 testPlayCar % npx react-native run-android
info A dev server is already running for this project on port 8081.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)

Task :react-native-carplay:compileDebugKotlin FAILED

[Incubating] Problems report is available at: file:///Users/roysabah/www/aaa/testPlayCar/android/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
53 actionable tasks: 5 executed, 48 up-to-date

info πŸ’‘ Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTListTemplate.kt:39:31 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTListTemplate.kt:42:36 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTabTemplate.kt:24:27 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTabTemplate.kt:27:21 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:156:32 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:158:33 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:190:13 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:195:11 None of the following candidates is applicable:
fun setText(p0: CharSequence): GridItem.Builder
fun setText(p0: CarText): GridItem.Builder
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:262:17 None of the following candidates is applicable:
fun addText(p0: CharSequence): Row.Builder
fun addText(p0: CarText): Row.Builder
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:309:31 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-carplay:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 13s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTListTemplate.kt:39:31 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTListTemplate.kt:42:36 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTabTemplate.kt:24:27 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTabTemplate.kt:27:21 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'com.facebook.react.bridge.ReadableMap?'.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:156:32 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:158:33 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:190:13 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:195:11 None of the following candidates is applicable:
fun setText(p0: CharSequence): GridItem.Builder
fun setText(p0: CarText): GridItem.Builder
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:262:17 None of the following candidates is applicable:
fun addText(p0: CharSequence): Row.Builder
fun addText(p0: CarText): Row.Builder
e: file:///Users/roysabah/www/aaa/testPlayCar/node_modules/react-native-carplay/android/src/main/java/org/birkir/carplay/parser/RCTTemplate.kt:309:31 Argument type mismatch: actual type is 'com.facebook.react.bridge.ReadableMap?', but 'com.facebook.react.bridge.ReadableMap' was expected. FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-carplay:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org. BUILD FAILED in 13s.

Android Auto (please complete the following information):

  • Device: [Hauwei]
  • Android Version: [Android 10]
  • RNCarPlay version [2.4.1-Beta0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions