lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.76k stars 652 forks source link

Not working on ReactNative 0.73 #794

Closed eduardoortegabyx closed 2 months ago

eduardoortegabyx commented 2 months ago

I am creating a brand new project in React Native 0.73.5 and as soon as I install react-native-config on my Mac I got this error (using npm run android):

info Opening app on Android...
info A dev server is already running for this project on port 8081.
info Installing the app...
> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
> Task :gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE

> Configure project :app
Reading env from: .env

> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :app:generateDebugBuildConfig
> Task :react-native-config:preBuild UP-TO-DATE
> Task :react-native-config:preDebugBuild UP-TO-DATE
> Task :react-native-safe-area-context:preBuild UP-TO-DATE
> Task :react-native-safe-area-context:preDebugBuild UP-TO-DATE
> Task :react-native-safe-area-context:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-screens:preBuild UP-TO-DATE
> Task :react-native-screens:preDebugBuild UP-TO-DATE
> Task :react-native-screens:writeDebugAarMetadata UP-TO-DATE
> Task :react-native-config:writeDebugAarMetadata
> Task :app:generateDebugResValues
> Task :react-native-config:generateDebugResValues
> Task :react-native-config:generateDebugResources
> Task :react-native-config:packageDebugResources
> Task :react-native-safe-area-context:generateDebugResValues UP-TO-DATE
> Task :react-native-safe-area-context:generateDebugResources UP-TO-DATE
> Task :react-native-safe-area-context:packageDebugResources UP-TO-DATE
> Task :react-native-screens:generateDebugResValues UP-TO-DATE
> Task :react-native-screens:generateDebugResources UP-TO-DATE
> Task :react-native-screens:packageDebugResources UP-TO-DATE
> Task :app:mapDebugSourceSetPaths UP-TO-DATE
> Task :app:generateDebugResources
> Task :app:checkDebugAarMetadata
> Task :app:packageDebugResources
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-config:extractDeepLinksDebug
> Task :react-native-safe-area-context:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-safe-area-context:processDebugManifest UP-TO-DATE
> Task :react-native-screens:extractDeepLinksDebug UP-TO-DATE
> Task :react-native-screens:processDebugManifest UP-TO-DATE
> Task :app:parseDebugLocalResources

> Task :react-native-config:processDebugManifest
package="com.lugg.RNCConfig" found in source AndroidManifest.xml: /Users/proco/Documents/Projects/ReactNative/node_modules/react-native-config/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored.
Recommendation: remove package="com.lugg.RNCConfig" from the source AndroidManifest.xml: /Users/proco/Documents/Projects/ReactNative/node_modules/react-native-config/android/src/main/AndroidManifest.xml.

> Task :react-native-config:compileDebugLibraryResources
> Task :app:mergeDebugResources
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugManifestForPackage UP-TO-DATE
> Task :react-native-safe-area-context:compileDebugLibraryResources UP-TO-DATE
> Task :react-native-safe-area-context:parseDebugLocalResources UP-TO-DATE
> Task :react-native-safe-area-context:generateDebugRFile UP-TO-DATE
> Task :react-native-screens:compileDebugLibraryResources UP-TO-DATE
> Task :react-native-screens:parseDebugLocalResources UP-TO-DATE
> Task :react-native-screens:generateDebugRFile UP-TO-DATE
> Task :react-native-config:parseDebugLocalResources
> Task :react-native-config:generateDebugBuildConfig
> Task :react-native-safe-area-context:generateDebugBuildConfig UP-TO-DATE
> Task :react-native-config:javaPreCompileDebug
> Task :react-native-config:generateDebugRFile
> Task :react-native-safe-area-context:compileDebugKotlin UP-TO-DATE
> Task :react-native-config:compileDebugJavaWithJavac FAILED
> Task :app:processDebugResources

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.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
48 actionable tasks: 20 executed, 28 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 

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-config:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':react-native-config:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/proco/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Users/proco/.sdkman/candidates/java/21.0.2-tem/bin/jlink with arguments {--module-path /Users/proco/.gradle/caches/transforms-3/732b80062cb61a055a8366ca368affd1/transformed/output/temp/jmod --add-modules java.base --output /Users/proco/.gradle/caches/transforms-3/732b80062cb61a055a8366ca368affd1/transformed/output/jdkImage --disable-plugin system-modules}

* 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 28s

I added the apply line into my android/app/build.gradle:

apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

Any help would be appreciated.

eduardoortegabyx commented 2 months ago

Hey, it's me one day later and I am such an idiot. This was happening because I installed the latest Java version the one I had to install was Java 17.