question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Execution failed for task ':app:compileDebugJavaWithJavac'. React Native

See original GitHub issue

Environment

OS: Windows 10 Node: 8.10.0 Yarn: 1.9.4 npm: 6.4.1 Watchman: Not Found Xcode: N/A Android Studio: Version 3.1.0.0 AI-173.4819257 Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4.

Description

I created a new project with “create-react-native-app” and then ejected it to plain react native project. When i try to run “react-native run-android” command i get build failed with error Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Reproducible Demo

I executed following commands. create-react-native-project [projectname] cd [projectname] npm run eject react-native run-android

The result output is as follows.

`F:\react\xdceconverter>react-native run-android Scanning folders for symlinks in F:\react\xdceconverter\node_modules (118ms) Starting JS server… Building and installing the app on the device (cd android && gradlew.bat installDebug)… Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

Configure project :app WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Task :app:compileDebugJavaWithJavac F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:5: error: cannot find symbol import com.facebook.react.ReactApplication; ^ symbol: class ReactApplication location: package com.facebook.react F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:6: error: cannot find symbol import com.facebook.react.ReactNativeHost; ^ symbol: class ReactNativeHost location: package com.facebook.react F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:14: error: cannot find symbol public class MainApplication extends Application implements ReactApplication { ^ symbol: class ReactApplication F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:16: error: cannot find symbol private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { ^ symbol: class ReactNativeHost location: class MainApplication F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:36: error: cannot find symbol public ReactNativeHost getReactNativeHost() { ^ symbol: class ReactNativeHost location: class MainApplication F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity public class MainActivity extends ReactActivity { ^ F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:16: error: cannot find symbol private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { ^ symbol: class ReactNativeHost location: class MainApplication F:\react\xdceconverter\android\app\src\main\java\com\xdceconverter\MainApplication.java:35: error: method does not override or implement a method from a supertype @Override ^ 8 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • 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 41s 18 actionable tasks: 5 executed, 13 up-to-date Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html`

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:11

github_iconTop GitHub Comments

47reactions
shashank-sharkcommented, Mar 18, 2019

Step 1: Delete node_modules folder. Step 2: run “yarn install” without quotes. Step 3: Then run, “react-native run-android”.

If the above steps fails, then change react-native version to 0.57.5 in package.json file and then repeat the steps 1,2,3.

13reactions
KevinGeorgecommented, Nov 15, 2018

Same issue for me. i ejected my project from CRNA too. However when i create a new react-native project and run-android it works.

OS: Windows 10 Node: v10.7.0 npm : 6.1.0 Android studio 3.2.1 react : 16.5.0 react-native-cli: 2.0.1 react-native: 0.57.1

EDIT : It looks like i’ve corrected it, i had as a dependency in my package.json : “react-native”: “https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz”,

I changed it to : “react-native”: “0.57.5”,

and run “npm install”, and now it works…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution failed for task ':app:compileDebugJavaWithJavac ...
This error occur because you RN version is different from Android's build.gradle version. When you create a react-native app probably it ...
Read more >
what went wrong: execution failed for task ':app ... - You.com
Execution failed for task ':app:compileDebugJavaWithJavac'. react-native ... When you create a react-native app probably it create android app like:.
Read more >
Execution Failed for task app compileDebugJavaWithJavac in ...
I am developing an Android App in Android Studio. Not quite sure what went wrong. I was successfully building a few days ago....
Read more >
React Native Android : FAILURE: Build failed with ... - A Shirazee
Execution failed for task ':app:compileDebugJavaWithJavac'. > Task :app:compileDebugJavaWithJavac FAILED. This is an issue with how Gradle is ...
Read more >
Fix "Execution Failed for task :app ... - GeeksforGeeks
Fix “Execution Failed for task :app:compileDebugJavaWithJavac” in Android Studio · Method: #1 Try updating your buildToolsVersion to “23.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found