upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:70: error: duplicate class: com.facebook.react.PackageList public class PackageList {

Open SrinjoyBarman opened this issue 1 year ago • 11 comments

/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:70: error: duplicate class: com.facebook.react.PackageList public class PackageList { ^ 1 error FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

SrinjoyBarman avatar Aug 17 '24 05:08 SrinjoyBarman

I think you forgot to remove this code at the bottom of andoird/app/build.gradle

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

iwangsyah avatar Aug 19 '24 06:08 iwangsyah

@iwangsyah I had the same problem, and this answer helped me! I think I actually forgot to delete the code in that line 😄

jieey1140 avatar Aug 20 '24 02:08 jieey1140

It seems I'm facing a similar issue. I'm unsure why this file is being generated after deletion and why it's necessary to run the app. Additionally, I've noticed that in some React Native projects, this file isn't even present.

I faced the same issue when I migrated my project from React Native version 0.74.x to 0.75.x. I finally resolved it.

MAsadIlyasNajum avatar Sep 09 '24 12:09 MAsadIlyasNajum

android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:56: error: duplicate class: com.facebook.react.PackageList public class PackageList { ^ 1 error

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

I am still getting this error and above solution didn't worked for me

react-native version 0.74.2

anyone can suggest me for the solution

Thanks

manishmobmaxime avatar Oct 18 '24 04:10 manishmobmaxime

@manishmobmaxime Did you find any solution?

shahid3130khan avatar Oct 22 '24 07:10 shahid3130khan

@shahid3130khan @manishmobmaxime did you fix this?

nguyenhoanglam avatar Dec 10 '24 02:12 nguyenhoanglam

I think you forgot to remove this code at the bottom of andoird/app/build.gradle

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I was having the same issue migrating from 0.74.5 to 0.76.5. The solution suggested here fixed the problem, however, the line to be deleted was not at the end of the file, but at line 122 (a few lines before the end).

frankl1 avatar Dec 15 '24 06:12 frankl1

I think you forgot to remove this code at the bottom of andoird/app/build.gradle apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I was having the same issue migrating from 0.74.5 to 0.76.5. The solution suggested here fixed the problem, however, the line to be deleted was not at the end of the file, but at line 122 (a few lines before the end).

I successfully solved the problem using the above method, but now it prompts me

Cannot resolve symbol 'SafeAreaContextPackage' Cannot resolve symbol 'RNScreensPackage' image

Can anyone provide some help?

looooool11111 avatar Dec 16 '24 03:12 looooool11111

I think you forgot to remove this code at the bottom of andoird/app/build.gradle apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I was having the same issue migrating from 0.74.5 to 0.76.5. The solution suggested here fixed the problem, however, the line to be deleted was not at the end of the file, but at line 122 (a few lines before the end).

I successfully solved the problem using the above method, but now it prompts me

Cannot resolve symbol 'SafeAreaContextPackage' Cannot resolve symbol 'RNScreensPackage' image

Can anyone provide some help?

Check if your app/build.gradle file has auto link enabled, as in the example below:

react { autolinkLibrariesWithApp() }

vinilima2 avatar Feb 25 '25 13:02 vinilima2

Combining this https://github.com/react-native-community/upgrade-support/issues/285#issuecomment-2295761824

With this https://github.com/react-native-community/upgrade-support/issues/285#issuecomment-2682062918

Solved the issue for me !

Julien-Allard avatar Apr 02 '25 14:04 Julien-Allard