Skip to content

[0.73] Crash build android app when update packages #41854

@ShchipskiiYura

Description

@ShchipskiiYura

Description

import com.brentvatne.react.ReactVideoPackage

...

 override fun getPackages(): ArrayList<ReactPackage> {
            packages.add(new ReactVideoPackage())
            // Packages that cannot be autolinked yet can be added manually here, for example:
            // packages.add(new MyReactNativePackage());
            return PackageList(this).packages

        }

When I try to add new package to getPackages method in android, I have crash a build with error

file:///Users/username/Desktop/projectName/android/app/src/main/java/com/projectName/MainApplication.kt:44:26 Unresolved reference: new

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

Steps to reproduce

yarn android

React Native Version

0.73

Affected Platforms

Runtime - Android

Output of npx react-native info

emulator pixel 4

Stacktrace or Logs

Note: Recompile with -Xlint:unchecked for details.
e: file:///Users/user/Desktop/projectName/android/app/src/main/java/com/projectName/MainApplication.kt:44:48 Expecting an expression
e: file:///Users/user/Desktop/projectName/android/app/src/main/java/com/projectName/MainApplication.kt:44:26 Unresolved reference: new

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app: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.

Reproducer

https://github.com/

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions