Comments (18)
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.
from react-native-nfc-card-reader.
@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
from react-native-nfc-card-reader.
@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.
==============================================================================
- Get more help at https://help.gradle.org
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.
==============================================================================
- Get more help at https://help.gradle.org
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 thegradle.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.
- Get more help at https://help.gradle.org
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.
- Get more help at https://help.gradle.org
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 thegradle.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.
- Get more help at https://help.gradle.org
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.
- Get more help at https://help.gradle.org
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.
from react-native-nfc-card-reader.
@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 :)
from react-native-nfc-card-reader.
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())
from react-native-nfc-card-reader.
Hi,
Same issue here. Any fix for 0.70.5?
Regards.
from react-native-nfc-card-reader.
I had a problem in RN 0.69.
can't found maven
And I can't run your example. It had same problem
from react-native-nfc-card-reader.
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
from react-native-nfc-card-reader.
@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?
from react-native-nfc-card-reader.
I fixed it by copying your code into my android folder and export native modules.
It worked
from react-native-nfc-card-reader.
Oops! Can you please check again @jackbayliss ?
from react-native-nfc-card-reader.
@ajaysidhu perfect!
Thanks
from react-native-nfc-card-reader.
Thanks for repo
from react-native-nfc-card-reader.
I have the same problem. Have you solved this issue?
from react-native-nfc-card-reader.
Any update we all are facing the same issue? @jackbayliss
from react-native-nfc-card-reader.
@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
from react-native-nfc-card-reader.
After spending hours of trying to make it work, I ended up downgrading my
gradle
version to6.9
and React Native version to0.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.
is there any app repo, u build after downgrading? if possible please share it with us, thanks in advance
from react-native-nfc-card-reader.
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.
from react-native-nfc-card-reader.
Related Issues (13)
- null is not an object (evaluating '_reactNativeNfcCardReader.default.startNfc') HOT 2
- Execution failed for task ':app:checkDebugDuplicateClasses'. HOT 6
- Support Gradle 7.0 HOT 4
- Support Gradle 8.0 HOT 11
- cvv read HOT 5
- read magnetic card HOT 1
- startNfc() not returning firstname and lastname HOT 3
- startNfc() not found error HOT 4
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. HOT 1
- names came out wrong
- use case for gradle 7.2< HOT 1
- Build errors after installing the package HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-nfc-card-reader.