react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

Task :react-native-code-push:compileDebugJavaWithJavac FAILED

Open dayaki opened this issue 2 years ago • 15 comments

I upgraded to react-native 0.66.0 and codepush stopped working, I keeping the error:

> Task :react-native-code-push:compileDebugJavaWithJavac FAILED An exception has occurred in the compiler (1.8.0_301). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)

Any help would be appreciated.

  • react-native-code-push version: 7.0.4
  • react-native version: 0.66.0

dayaki avatar Oct 12 '21 13:10 dayaki

+1

Zakyyy avatar Oct 25 '21 14:10 Zakyyy

Facing the same issue here, any leads on this?

frontendwizard avatar Oct 28 '21 13:10 frontendwizard

I had the same error, I don't think it was in the code push lib exactly tho, but I leave it here in case it helps someone, I bumped the target sdk to 31 because of another lib, this caused all sorts of problems. but after digging around I managed to leave it at sdk 30 by forcing an android dep to resolve to a lower version, turns out it was trying to use a release candidate version, here is how to force the dependency version, again I don't know if your problem is the same, I just had a similar error: android/app/build.gradle

android {
[...]
    configurations.all {
        resolutionStrategy {
            force 'androidx.browser:browser:1.3.0'
        }
    }
}

pedroraft avatar Oct 29 '21 16:10 pedroraft

Same issue, unfortunately @pedroraft's solution doesn't work on my end. But the cause is likely the same. I had to update the sdk to 31 for another library while upgrading our app to RN 0.66.3.

lucaswhitman avatar Nov 20 '21 17:11 lucaswhitman

RN: 0.66.3 TargetSdkVersion 31 Same issues, but after upgrade jdk to 11 and it's working fine Try to upgrade jdk to 11 :)

quanghoang2110 avatar Nov 29 '21 11:11 quanghoang2110

in my case, i had set compileSdkVersion 31 and targetSdkVersion 30 before. now, i set both to 30 and worked well.

mertbo avatar Nov 30 '21 13:11 mertbo

RN: 0.66.3 TargetSdkVersion 31 Same issues, but after upgrade jdk to 11 and it's working fine Try to upgrade jdk to 11 :)

This works 🎉

parth-koshta avatar Dec 01 '21 17:12 parth-koshta

upgrading to jdk 11 worked

faustoct1 avatar Dec 28 '21 19:12 faustoct1

For me updating to JDK 11 unfortunaltly does not work. To use react-native-vision-camera I need sdk 31 though. If anybody has an idea how to solve this dilemma I would be greatfull.

alexco2 avatar Jan 10 '22 19:01 alexco2

I was able to solve it. I had to upgrade the jdk that is referenced in JAVA_HOME in the environment variables, not only in Android studio.

alexco2 avatar Jan 14 '22 00:01 alexco2

https://github.com/microsoft/appcenter/issues/2067#issuecomment-888853402

For me, I also had to force AppCenter to use JDK 11 for native builds

kyle-ssg avatar Feb 13 '22 10:02 kyle-ssg

I had java 8, saw this error, then I just did:

sdk use java 11.0.14-ms

To install it if you dont have this version, it's just

sdk install java 11.0.14-ms

and it worked. I am on M1 Mac, not rosetta 2 terminal. Hope it helps!

bensonz avatar Apr 04 '22 04:04 bensonz

in my case, i had set compileSdkVersion 31 and targetSdkVersion 30 before. now, i set both to 30 and worked well.

This worked for me

dexiouz avatar May 25 '22 21:05 dexiouz

If you don't want to downgrade the compileSdkVersion or targetSdkVersion you can try downloading JDK 11 (worked for me).

Here's a guide on how to install it via homebrew for Mac users: https://medium.com/@kirebyte/using-homebrew-to-install-java-jdk11-on-macos-2021-4a90aa276f1c

mattgle avatar Jun 07 '22 18:06 mattgle

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

ghost avatar Aug 06 '22 21:08 ghost

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.

ghost avatar Aug 22 '22 00:08 ghost

I was having trouble and nothing was working. I was trying to debug in android studio by running the react-native-code-push:compileDebugJavaWithJavac directly like so Screen Shot 2022-11-04 at 4 36 30 PM I right clicked it and hit "edit run configuration" and then added the three flags --debug --stacktrace --scan; for whatever the reason, now it compiles just fine. I'm assuming it has something to do with some kind of gradle caching issue. But I don't know how to best clean that cache.

alita-moore avatar Nov 04 '22 21:11 alita-moore