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

Andoid app showing error ":app:compileDebugJavaWithJavac FAILED " #3437

Closed
sankhadeeproy007 opened this issue Oct 15, 2015 · 22 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@sankhadeeproy007
Copy link

Hi, I seem to have followed all the steps given in your docs correctly. I also got the iOS app to work, but I'm getting this error whenever I try to run it in android.
"Sankhadeeps-MacBook-Air:native sankhadeeproy$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee061Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore061Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp061Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0120Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
/Users/sankhadeeproy/Sites/projects/native/android/app/src/main/java/com/native/MainActivity.java:1: error: expected
package com.native;
^
/Users/sankhadeeproy/Sites/projects/native/android/app/build/generated/source/r/debug/com/native/R.java:8: error: expected
package com.native;
^
/Users/sankhadeeproy/Sites/projects/native/android/app/build/generated/source/buildConfig/debug/com/native/BuildConfig.java:4: error: expected
package com.native;
^
3 errors
:app:compileDebugJavaWithJavac FAILED

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.

BUILD FAILED

Total time: 27.348 secs
Could not install the app on the device, see the error above."
Any help would be appreciated.

@sankhadeeproy007
Copy link
Author

Solved! A new project with a different name fixed it.

@3210jr
Copy link

3210jr commented Oct 27, 2015

hi @sankhadeeproy007 did you just create a new project and copy over your files or what?
Thanks..

@sankhadeeproy007
Copy link
Author

No, it happened with a new project. However I did create a new project and copied some files over later in another project.

@Calvein
Copy link

Calvein commented Nov 2, 2015

It should be documented somewhere, you can't create a react-native project called native (I just had the same problem).

@sahas-
Copy link

sahas- commented Dec 22, 2015

It just happened to me. I started a hello world project but ended up doing more there.. finally, wanted to move them over. Created a new project with RN init and copied my assets over. npm install installed all dependencies and react-native run-android fails with this error "app:compileDebugJavaWithJavac FAILED". Any workarounds apart from recreating the project with different name?

@zubairahmad2
Copy link

please help me to remove this error
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@srisk94
Copy link

srisk94 commented Sep 22, 2016

I might be late but this may help to others also.yesterday I came across asame issue then I changed sdk versions in gradle file ,problem solved :)

@parkerproject
Copy link

You creating a new project and new name doesn't look like a real solution to this.

@TomIsYourName
Copy link

Seems there is a bug in android studio, i got the same error when i started a new project, in my case, it happens because i choose scrolling activity first by mistake, and then i go back with the previous button, choose empty activity with a name MainActivity. After i clicked the finish button, the stupid AS create an activity called MainActivity, but instead of activity_main.xml in layout folder, there was the content_scrolling.xml has been created.

@zubairahmad2
Copy link

zubairahmad2 commented Jan 3, 2017 via email

@hellomaya
Copy link

If you have Android studio, then try open the android code, and run 'project' ==> 'clean', or just do cd android & ./gradlew clean, probably solve the issue.

@aeruhxi
Copy link

aeruhxi commented Oct 12, 2017

cd android & ./gradlew clean solves it but it slows down every build. Isn't there a proper fix to this?

@akshaydoiphode
Copy link

akshaydoiphode commented Nov 3, 2017

Please help me solve error With nativescript with JavaScript. When I tried to built project it gives this error. I tried some of above solutions. But nothing works for me.
Execution failed for task ':compileF0F1F2F3F4DebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

@mjbayhon
Copy link

untitled

@mjbayhon
Copy link

kindly please help me with this
untitled

@hugoh59
Copy link

hugoh59 commented Jan 31, 2018

Getting same issue

> Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED /Users/.../node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBAppEventsLoggerModule.java:209: error: cannot find symbol @ReactMethod(isBlockingSynchronousMethod = true) ^ symbol: method isBlockingSynchronousMethod() location: @interface ReactMethod Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /Users/hugohyz/code/hugoh1995/dogtime_react/DogtimeReactInit/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/Utility.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error

@pankajnvhatkar
Copy link

please help me to remove this error
TRIED WITH 2 DIFFERENT PROJECTS BUT BOTH OF THEM GIVEN SAME OUTPUTS

1 error
:app:compileDebugJavaWithJavac FAILED

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.

BUILD FAILED

Total time: 24.051 secs
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

@nmerchant
Copy link

Also running into this. Had a project running successfully on another machine, cloned my repo to this machine, and as far as I can tell I have everything set up correctly but still getting this pop up. Running ./gradlew clean from the Android folder also doesn't seem to do anything.

@sumitsavla
Copy link

I was getting same issue -> failed for task ':app:compileDebugJavaWithJavac'.

Updating react-native-fbsdk to 0.7.0 in package.json fixed it for me! :)

@amrlabib
Copy link

amrlabib commented Feb 18, 2018

Try the this stack overflow answer Basically clear global .gradle cache

@Ameen-Alam
Copy link

please help me !
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.

BUILD FAILED

Total time: 23.054 secs
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

@TheShantam
Copy link

I solved this issue by deleting the .gradle folder inside the android folder.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests