Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error in react-native 0.7 #21

Open
duylinhdang1998 opened this issue Oct 18, 2022 · 18 comments
Open

Build error in react-native 0.7 #21

duylinhdang1998 opened this issue Oct 18, 2022 · 18 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@duylinhdang1998
Copy link

duylinhdang1998 commented Oct 18, 2022

I got the error in this image in RN 0.7 when I try to run
image

@duylinhdang1998
Copy link
Author

I had a problem in RN 0.69.
can't found maven
And I can't run your example. It had same problem

@jackbayliss
Copy link
Owner

@duylinhdang1998 Sorry for my super late reply, it's been a while since I've touched RN.

Have you tried branches
https://github.com/jackbayliss/react-native-nfc-card-reader/tree/gradle7.0 or
https://github.com/jackbayliss/react-native-nfc-card-reader/tree/gradle7.2

@ajaysidhu
Copy link

I am also facing the same issue and have tried all 3 branches:

npm install react-native-nfc-card-reader --save

npm install "https://github.com/jackbayliss/react-native-nfc-card-reader.git#gradle7.0" --save

npm install "https://github.com/jackbayliss/react-native-nfc-card-reader.git#gradle7.2" --save

@jackbayliss
Copy link
Owner

@ajaysidhu Thank you for letting me know, I need to dedicate some time to investigating when I'm free. Do you have a RN sample app I can use for testing?

@duylinhdang1998
Copy link
Author

I fixed it by copying your code into my android folder and export native modules.
It worked

@ajaysidhu
Copy link

@jackbayliss Here is the minimal project with the issues:

With default installation: https://github.com/ajaysidhu/nfc-card-reader-bug-report/tree/with-default-installation

CLI output with default installation user@MacBook-Pro nfctest % npm run android

[email protected] android
react-native run-android

info JS server already running.
info Installing the app...

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

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

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 23

  • What went wrong:
    A problem occurred evaluating project ':react-native-nfc-card-reader'.

Plugin with id 'maven' not found.

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

compileSdkVersion is not specified. Please add it to build.gradle

  • 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.
==============================================================================

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 23

  • What went wrong:
    A problem occurred evaluating project ':react-native-nfc-card-reader'.

Plugin with id 'maven' not found.

  • 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.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

compileSdkVersion is not specified. Please add it to build.gradle

  • 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.
==============================================================================

BUILD FAILED in 2s

at makeError (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/user/nfctest/node_modules/@react-native-community/cli/build/index.js:142:9)

info Run CLI with --verbose flag for more details.

With gradle7.0 branch: https://github.com/ajaysidhu/nfc-card-reader-bug-report/tree/with-gradle7.0

CLI output with gradle7.0 branch installation user@MacBook-Pro nfctest % npm run android

[email protected] android
react-native run-android

info JS server already running.
info Installing the app...

Task :react-native-gradle-plugin:compileKotlin
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (157, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (163, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (171, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (114, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with root to point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (27, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (130, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/user/nfctest/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (251, 14): 'BaseVariant' is deprecated. Deprecated in Java

Configure project :react-native-nfc-card-reader
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

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

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

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 executed

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 114

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

Configuration with name 'compile' not found.

  • 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.

BUILD FAILED in 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 114

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

Configuration with name 'compile' not found.

  • 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.

BUILD FAILED in 5s

at makeError (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/user/nfctest/node_modules/@react-native-community/cli/build/index.js:142:9)

info Run CLI with --verbose flag for more details.

With gradle7.2: https://github.com/ajaysidhu/nfc-card-reader-bug-report/tree/with-gradle7.2

CLI output with gradle7.2 installation

user@MacBook-Pro nfctest % npm run android

[email protected] android
react-native run-android

info JS server already running.
info Installing the app...

Configure project :react-native-nfc-card-reader
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

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

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

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 118

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

Could not resolve all files for configuration ':react-native-nfc-card-reader:customConfig'.
Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-nfc-card-reader
> Cannot choose between the following variants of com.facebook.react:react-native:0.70.4:
- debugVariantDefaultRuntimePublication
- releaseVariantDefaultRuntimePublication
All of them match the consumer attributes:
- Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.4:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'releaseVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.4:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it

  • 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.

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/user/nfctest/node_modules/react-native-nfc-card-reader/android/build.gradle' line: 118

  • What went wrong:
    A problem occurred configuring project ':react-native-nfc-card-reader'.

Could not resolve all files for configuration ':react-native-nfc-card-reader:customConfig'.
Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-nfc-card-reader
> Cannot choose between the following variants of com.facebook.react:react-native:0.70.4:
- debugVariantDefaultRuntimePublication
- releaseVariantDefaultRuntimePublication
All of them match the consumer attributes:
- Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.4:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'releaseVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.70.4:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it

  • 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.

BUILD FAILED in 2s

at makeError (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/user/nfctest/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/user/nfctest/node_modules/@react-native-community/cli/build/index.js:142:9)

info Run CLI with --verbose flag for more details.

@jackbayliss
Copy link
Owner

@ajaysidhu Thanks for the information, I can't see the project sadly- could you make it public? I just need the basics so I can tinker with it :)

@ajaysidhu
Copy link

Oops! Can you please check again @jackbayliss ?

@jackbayliss
Copy link
Owner

@ajaysidhu perfect!

Thanks

@duylinhdang1998
Copy link
Author

Thanks for repo

@DanielShaban
Copy link

I have the same problem. Have you solved this issue?

@DanielShaban
Copy link

DanielShaban commented Nov 26, 2022

I opened the Android project in Android Studio. And it shows some problems with building the Gradle project and shows that the problem in
react-native-nfc-card-reader\android\build.gradle' line: 118
So I just commented the line below and it's working now. but shows only card number and date
classpath += files(project.getConfigurations().getByName('customConfig').asList())

@ajaysidhu
Copy link

After spending hours of trying to make it work, I ended up downgrading my gradle version to 6.9 and React Native version to 0.67.4. It was painful to downgrade React Native version from 0.70 to 0.67, but it was the only solution for me because NFC card scanning was an important feature for our app.

Screenshot 2022-11-27 at 9 03 57 AM

Screenshot 2022-11-27 at 9 03 32 AM

@veyselkoru
Copy link

Hi,
Same issue here. Any fix for 0.70.5?
Regards.

@Adeel984
Copy link

Adeel984 commented Dec 22, 2022

Any update we all are facing the same issue? @jackbayliss

@jackbayliss
Copy link
Owner

@Adeel984 I will check over the holiday period, I built this a long time ago so I'm not sure what's changed, it seems gradle doesn't play ball.

I will download the latest RN version and see what I can do while I'm free ☺️

@jackbayliss jackbayliss added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 26, 2023
@korijamal
Copy link

After spending hours of trying to make it work, I ended up downgrading my gradle version to 6.9 and React Native version to 0.67.4. It was painful to downgrade React Native version from 0.70 to 0.67, but it was the only solution for me because NFC card scanning was an important feature for our app.

Screenshot 2022-11-27 at 9 03 57 AM Screenshot 2022-11-27 at 9 03 32 AM

is there any app repo, u build after downgrading? if possible please share it with us, thanks in advance

@jackbayliss
Copy link
Owner

This issue is still a thing, if anyone has time to make a PR I will for sure pull it in. I haven't had time to do any updates, I'm no longer working on apps etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants