Repository navigation
[0.73] Crash build android app when update packages #41854
Copy link
Copy link
Closed
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.Needs: Version InfoPlatform: AndroidAndroid applications.Android applications.
Description
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
Screenshots and Videos
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.Needs: Version InfoPlatform: AndroidAndroid applications.Android applications.
Activity
github-actions commentedon Dec 8, 2023
github-actions commentedon Dec 8, 2023
cortinico commentedon Dec 8, 2023
Closing as you provided no reproducer.
Your code is not compiling, most likely because you have a missing
import.Sadly without a reproducer I can't tell you exaclty which line is broken and which import to include
professorkolik commentedon Dec 19, 2023
@cortinico there is no need to create reproducer since the "issue" exists in ReproducerApp by default
It's about this line
https://github.com/react-native-community/reproducer-react-native/blob/main/ReproducerApp/android/app/src/main/java/com/reproducerapp/MainApplication.kt#L21
Just uncomment
packages.add();and AndroidStudio will throw error =>Unresolved reference: addSo I assume it should look smth like
[UPD] Additionally because of moving to Kotlin no need to have
newfor creating instance as per https://kotlinlang.org/docs/classes.html#creating-instances-of-classescortinico commentedon Dec 27, 2023
@professorkolik this will be fixed in 0.73.2
The fix is here: #41856
It's a comment also so it's a low priority fix.
professorkolik commentedon Dec 27, 2023
@cortinico thank you