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

Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'. #1037

Closed
wolfcode opened this issue Jun 27, 2019 · 19 comments
Closed

Comments

@wolfcode
Copy link

Bug

I ran following comments for setup,
npm i react-native-copilot
npm i react-native-svg
react-native link react-native-svg

everything fine, but I'm getting build time error.

Task :react-native-svg:compileDebugJavaWithJavac FAILED
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:100: error: cannot find symbol
START,
^
symbol: variable START
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:101: error: cannot find symbol
END,
^
symbol: variable END
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:119: error: cannot find symbol
MARGIN_START,
^
symbol: variable MARGIN_START
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:120: error: cannot find symbol
MARGIN_END,
^
symbol: variable MARGIN_END
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:130: error: cannot find symbol
PADDING_START,
^
symbol: variable PADDING_START
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:131: error: cannot find symbol
PADDING_END,
^
symbol: variable PADDING_END
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:134: error: cannot find symbol
BORDER_START_WIDTH,
^
symbol: variable BORDER_START_WIDTH
location: class RenderableViewManager.RenderableShadowNode
/Users/mahendran.m/workspace/ekart-stormtrooper/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:135: error: cannot find symbol
BORDER_END_WIDTH,
^
symbol: variable BORDER_END_WIDTH
location: class RenderableViewManager.RenderableShadowNode
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

Environment info

info
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 25.87 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.1, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-24 | Google APIs ARM 64 v8a, android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: ^16.8.6 => 16.8.6
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1

Library version: ^9.5.1

Steps To Reproduce

  1. npm i react-native-copilot
  2. npm i react-native-svg
  3. react-native link react-native-svg
  4. react-native run-android

Describe what you expected to happen:

  1. successful build
@tholder
Copy link

tholder commented Aug 29, 2019

Did you get any where with this? isue #779 suggests it is fixed in v7.0.2 but I am experiencing with v9.7.1

@msand
Copy link
Collaborator

msand commented Aug 29, 2019

That's really strange, those should come from react-native. Can you make a git repo with a reproduction?

@tholder
Copy link

tholder commented Aug 30, 2019

Thanks for coming back. Unfortunately this is in a massive repo I'm trying to upgrade (from react native 0.54.4 to 0.59.10) and my react native knowledge isn't very strong to do a reproduction.

Here is the dependencies section of package.json:

"dependencies": {
    "@tradle/react-native-http": "^2.0.0",
    "assert": "^1.4.1",
    "axios": "^0.18.0",
    "browserify-zlib": "^0.1.4",
    "buffer": "^5.1.0",
    "console-browserify": "^1.1.0",
    "constants-browserify": "^1.0.0",
    "dns.js": "^1.0.1",
    "domain-browser": "^1.2.0",
    "events": "^1.1.1",
    "https-browserify": "0.0.1",
    "libphonenumber-js": "^1.4.2",
    "moment": "^2.21.0",
    "path-browserify": "0.0.0",
    "process": "^0.11.10",
    "punycode": "^1.4.1",
    "querystring-es3": "^0.2.1",
    "react": "16.8.3",
    "react-native": "0.59.10",
    "react-native-camera": "^1.1.4",
    "react-native-collapsible": "^0.13.0",
    "react-native-config": "simpleweb/react-native-config",
    "react-native-crypto": "^2.1.2",
    "react-native-dialog": "^5.5.0",
    "react-native-doc-viewer": "^2.7.8",
    "react-native-document-picker": "https://github.com/Elyx0/react-native-document-picker.git#v3",
    "react-native-file-type": "0.0.8",
    "react-native-firebase": "^5.2.3",
    "react-native-fs": "^2.13.2",
    "react-native-google-signin": "^1.2.0",
    "react-native-haptic": "^1.0.1",
    "react-native-image-picker": "^0.28.0",
    "react-native-indicators": "^0.13.0",
    "react-native-keyboard-aware-scroll-view": "^0.7.2",
    "react-native-keychain": "3.0.0",
    "react-native-level-fs": "^3.0.0",
    "react-native-os": "^1.1.0",
    "react-native-qrcode-svg": "^5.1.1",
    "react-native-randombytes": "^3.0.0",
    "react-native-scalable-image": "^0.4.0",
    "react-native-sodium": "^0.3.4",
    "react-native-splash-screen": "^3.1.1",
    "react-native-svg": "^9.7.1",
    "react-native-swipe-list-view": "^1.5.8",
    "react-native-swiper": "^1.5.13",
    "react-native-switch": "^1.5.0",
    "react-native-tcp": "^3.3.0",
    "react-native-text-size": "^2.0.4",
    "react-native-touch-id": "^4.0.4",
    "react-native-udp": "^2.3.1",
    "react-native-uuid-generator": "^4.0.1",
    "react-native-vector-icons": "^4.6.0",
    "react-navigation": "^1.6.0",
    "react-navigation-redux-helpers": "^1.0.3",
    "react-redux": "^5.0.7",
    "readable-stream": "^1.0.33",
    "redux": "^3.7.2",
    "redux-action-buffer": "^1.2.0",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.9.1",
    "redux-saga": "^0.16.0",
    "stream-browserify": "^1.0.0",
    "string_decoder": "^0.10.31",
    "styled-components": "^4.3.2",
    "timers-browserify": "^1.4.2",
    "tty-browserify": "0.0.0",
    "url": "^0.10.3",
    "url-parse": "^1.4.3",
    "util": "^0.10.3",
    "vm-browserify": "0.0.4"
  },

@msand
Copy link
Collaborator

msand commented Aug 30, 2019

A reproduction project would most likely contain only react-native and react-native-svg, and absolutely nothing else, with the smallest possible amount of code/changes to show the issue.

@msand
Copy link
Collaborator

msand commented Aug 30, 2019

Essentially https://github.com/react-native-community/react-native-svg#troubleshooting

react-native init CleanProject
cd CleanProject/
yarn add react-native-svg
cd ios && pod install && cd ..

And everything should work correctly.

@Belouccio
Copy link

Belouccio commented Aug 30, 2019

I have the same problem. I run this
yarn add react-native-svg
react-native link react-native-svg
Now when i runing react-native run-android i got this error Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.

Sorry for my bad English

@msand
Copy link
Collaborator

msand commented Aug 30, 2019

Again, can you make a git repo with a minimal reproduction?

@tholder
Copy link

tholder commented Aug 30, 2019

I've done a minimal reproduction and it doesn't occur. I'll try and compare the two and see if I can find where it is failing. I guess it must be something in the gradle build process so I'll start there. Thanks for your help though and your patience with a react-native n00b 😄

@tholder
Copy link

tholder commented Aug 30, 2019

Interestingly, I have noticed the clean project does seem to run the task react-native-svg:compileDebugJavaWithJavac but it leaves it on the console wherease the others vanish. My other project has a much more verbose run output so I'm going to investigate if it's got some sort of switch to make it break on warnings.

The output I get on the clean project is:

react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 891 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...

> Task :react-native-svg:compileDebugJavaWithJavac

> Task :app:installDebug
10:46:44 V/ddms: execute: running am get-config
10:46:44 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
10:46:44 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel_2_XL_API_Q(AVD) - 9' for app:debug
10:46:44 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
10:46:44 D/Device: Uploading file onto device 'emulator-5554'
10:46:44 D/ddms: Reading file permision of /Users/tholder/SvgDebug/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
10:46:45 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
10:46:50 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:46:50 V/ddms: execute: returning
10:46:50 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
10:46:51 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:46:51 V/ddms: execute: returning
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 36s
47 actionable tasks: 34 executed, 13 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.svgdebug/.MainActivity }

@msand
Copy link
Collaborator

msand commented Aug 30, 2019

Interesting, at least it seems to build correctly. So the issue could be related to caching, have you tried cleaning the project? Or some gradle configs.

@tholder
Copy link

tholder commented Aug 30, 2019

Ok, I found it. It was a problem with my build.gradle. Obviously this is because I'm a) doing a big upgrade and b) don't know what I'm doing!

diff --git a/android/build.gradle b/android/build.gradle
index 79f7a803..05d74d0a 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -34,9 +34,9 @@ wrapper {

 ext {
     minSdkVersion = 16
-    compileSdkVersion = 26
-    targetSdkVersion = 26
-    supportLibVersion = "26.1.0"
+    compileSdkVersion = 28
+    targetSdkVersion = 28
+    supportLibVersion = "28.0.0"
 }

 subprojects {
@@ -45,7 +45,7 @@ subprojects {
         resolutionStrategy.eachDependency { details ->
             if (details.requested.group == 'com.android.support'
                 && !details.requested.name.contains('multidex') ) {
-                details.useVersion "26.1.0"
+                details.useVersion "28.0.0"
             }
         }
     }

@aristech
Copy link

aristech commented Sep 1, 2019

this was my error
.../node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathParser.java:43: error: ';'
put a semicolon after break fixed it

@msand msand closed this as completed Sep 28, 2019
@15110011
Copy link

I'm facing with 2 problem:
If I use [email protected] this will fix Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.
But will get this error Error while updating property 'd' in shadow node of type RNSVGPath for input string 'h'and vice versa.
And now I dont know how to solve this case @@

@NguyenPhuongNam99
Copy link

Please install version 4.2.4

@lfabl
Copy link

lfabl commented Oct 22, 2022

Please run this and then test again:

yarn remove react-native-svg

or

npm uninstall react-native-svg

@Kundannetset
Copy link

Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':react-native-svg: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}.

@UserXpert
Copy link

UserXpert commented Feb 19, 2024

Still getting this error. even with a new clean project.
Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.

On removing package error foes and App compiles

@naco-siren
Copy link

Same

@Prashants23
Copy link

anyone found any solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests