react-native-push-notification: Execution failed for task ':react-native-push-notification:compileReleaseJavaWithJavac'
Hi,
I’m sorry if this has been resolved already, but I’ve been stuck with this for a while now. I’ve installed the package, and did the link as per the README
. Added the extra info in the AndroidManifest.xml
after doing a link. I even tried to install the package and do a manual installation for android. It keeps failing to build.
My build.gradle looks like this
defaultConfig { applicationId "exampleProject" minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName "1.0" ndk { abiFilters "armeabi-v7a", "x86" } }
The error that I get is:
:react-native-push-notification:compileReleaseJavaWithJavac
:react-native-push-notification:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:7: error: cannot find symbol
import android.app.NotificationChannel;
^
symbol: class NotificationChannel
location: package android.app
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:162: error: constructor Builder in class Builder cannot be applied to given types;
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:480: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
^
symbol: variable O
location: class VERSION_CODES
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:488: error: cannot find symbol
int importance = NotificationManager.IMPORTANCE_DEFAULT;
^
symbol: variable IMPORTANCE_DEFAULT
location: class NotificationManager
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:489: error: cannot find symbol
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
^
symbol: class NotificationChannel
location: class RNPushNotificationHelper
/Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java:489: error: cannot find symbol
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
^
symbol: class NotificationChannel
location: class RNPushNotificationHelper
Note: /Users/umair/Desktop/Projects/*****/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/helpers/ApplicationBadgeHelper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors
:react-native-push-notification:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-push-notification:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Any help or suggestions would be greatly appreciated. Thanks
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 20
- Comments: 36 (4 by maintainers)
after manual link on android, install older version with “npm install --save react-native-push-notification@2.0.1” fixed Javac issue
[Solved] How to solve Task :react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only
When will we have an official release with the right fix instead of doing workaround like above?
Just fixed it by adding this to android/build.gradle file:
I solved this issue by keeping the version same both side.
Inside my project:
android/build.gradle:
android/app/build.gradle:
Inside react-native-push-notification/android/build.gradle
@ahmedu007 I think that error is referred to #801 and also @danferd is right, I had to downgrade to version 3.0.2
Going back to 3.0.2 fixed the issue. I’ve also updated the SDK to use 27 now. But it still wont build on the latest version. The same error comes back
This configuration worked for me.
Change values to these inside react-native-push-notification/android/build.gradle
Fixed this issue by following instructions in the First step of Android manual installation
In your android/build.gradle
no need to change nodemodules just use this “android/build.gradle”
` // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { repositories { jcenter() maven { url ‘https://maven.google.com/’ name ‘Google’ } } dependencies { classpath ‘com.android.tools.build:gradle:3.0.0’
}
allprojects { repositories { mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url “$rootDir/…/node_modules/react-native/android” } maven { url ‘https://maven.google.com/’ name ‘Google’ } maven { url “https://jitpack.io” } } }
ext { compileSdkVersion = 27 targetSdkVersion = 27 buildToolsVersion = “27.0.2” supportLibVersion = “27.0.2” googlePlayServicesVersion = “11.8.0” androidMapsUtilsVersion = “0.5+” }
`
I got this error too after updated to version 3.1.1
I’m using targetSdkVersion 26 but still failed to sign the apk.
compileSdkVersion: 26 minSdkVersion: 16 targetSdkVersion: 26
@GleidsonDaniel I’ve been using 3.1.1 since release without any problems.
Here’s the configurations that I’ve been using on my android/build.gradle
@epeli Thank you so much. you save me.
We also hit this issue with version 3.1.1 and RN 0.55.4.
Here’s a patch of the commit which fixed this for our project
https://gist.github.com/epeli/e5b192c3b75ba84e5ec695d124de1e86
We also hit some compatibility issues with react-native-maps too… Hence the changes for
com.google.android.gms:play-services-maps
I also manually merged https://github.com/zo0r/react-native-push-notification/pull/826 to my node_modules.
Im using :
and still get this error.