microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

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

Closed dayaki closed 2 years ago

dayaki commented 3 years ago

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.

Zakyyy commented 3 years ago

+1

frontendwizard commented 3 years ago

Facing the same issue here, any leads on this?

pedroraft commented 3 years ago

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'
        }
    }
}
lucaswhitman commented 2 years ago

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.

quanghoang2110 commented 2 years ago

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 :)

mertbo commented 2 years ago

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

parth-koshta commented 2 years ago

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 🎉

faustoct1 commented 2 years ago

upgrading to jdk 11 worked

alexco2 commented 2 years ago

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 commented 2 years ago

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.

kyle-ssg commented 2 years ago

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

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

bensonz commented 2 years ago

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!

dexiouz commented 2 years ago

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

mattgle commented 2 years ago

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

ghost commented 2 years ago

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 commented 2 years ago

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.

alita-moore commented 1 year ago

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.