3

enter image description here

FAILURE: Build failed with an exception.

  • Where: Build file 'D:\AndroidApps\SenFinApp\node_modules\react-native-device-info\andro id\build.gradle' line: 29

  • What went wrong: A problem occurred evaluating project ':react-native-device-info'.

    Could not find method implementation() for arguments [com.facebook.react:react -native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies. DefaultDependencyHandler.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.084 secs

D:\AndroidApps\SenFinApp\android>

I tried to get deviceId using react-native-device-info in react native.then I got below error. use React-native version "react-native": "0.48.3",

in line 29

implementation 'com.facebook.react:react-native:+'

I follow the instructions of below link:

https://github.com/rebeccahughes/react-native-device-info

please help me

Thanks.

SahanS
  • 675
  • 3
  • 9
  • 21
  • Could you post the actual error? Also, try to refrain from posting messages in image format. Better to copy and paste the output and put it in a quote. – Kraylog Jan 10 '19 at 05:58
  • ok, Could not find method implementation() for arguments [com.facebook.react:react -native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies. DefaultDependencyHandler. – SahanS Jan 10 '19 at 06:15
  • What version of gradle are you running? – Kraylog Jan 10 '19 at 06:16
  • classpath 'com.android.tools.build:gradle:2.2.3' – SahanS Jan 10 '19 at 06:21
  • This is probably happening since react-native-device-info upgraded to gradle 3+, which required changing `compile` to `implementation`. You'll need to upgrade as well. – Kraylog Jan 10 '19 at 06:32
  • After upgrade got below error FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':react-native-device-info'. > Failed to find target with hash string '23' in: C:\Users\Dell\AppData\Local\An droid\sdk * 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 1s – SahanS Jan 10 '19 at 06:53
  • 1
    Perhaps [this](https://stackoverflow.com/questions/33417537/failed-to-find-target-with-hash-string-android-23) could help – Kraylog Jan 10 '19 at 07:05
  • yes ,I went through your path finally its work thanks @Kraylog – SahanS Jan 10 '19 at 07:58

1 Answers1

0

Just now I got this issue I fixed using the below fix. "react-native-device-info": "^2.3.2",

  1. go to file /node_modules/react-native-device-info/android/build.gradle Replace
  2. implementation with compile

Before: enter image description here

After: enter image description here