Skip to content

Error building on Android. #867

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

Closed
dev4bitcoin opened this issue May 2, 2022 · 8 comments · Fixed by #868
Closed

Error building on Android. #867

dev4bitcoin opened this issue May 2, 2022 · 8 comments · Fixed by #868

Comments

@dev4bitcoin
Copy link

dev4bitcoin commented May 2, 2022

I installed latest version of this library and getting build issue on Android. It is working fine on iOS.

Version:

"react-native": "0.64.3",
"react-native-notifications": "^4.3.1",

Freshly installed yesterday and getting this issue.

Here is the error. Anyone have any idea?

Execution failed for task ':react-native-notifications:compileReactNative60DebugJavaWithJavac'. node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/ReactAppLifecycleFacade.java:50: error: cannot find symbol return mReactContext.hasActiveReactInstance(); ^ symbol: method hasActiveReactInstance() location: variable mReactContext of type ReactContext

@riogrande100
Copy link

Downgrading to 4.2.4 worked for me.

@dev4bitcoin
Copy link
Author

dev4bitcoin commented May 2, 2022

Downgrading to 4.2.4 worked for me.

I downgraded to 4.3.0 and able to build successfully. Now I can see the notification received in console but not in the notification center. Is it working fine on Android?

@DanielEliraz
Copy link
Collaborator

starting [email protected] they changed the function name. I'll add them both

@dev4bitcoin
Copy link
Author

Is that function name change for notification not recieving in Notification Center but able to see in console?

@luizppa
Copy link

luizppa commented May 9, 2022

It did not solved the problem for me in a forked version of this repository (up to date with master) and RN 0.64.2.
Using:

@Override
public synchronized boolean isReactInitialized() {
    if (mReactContext == null) {
        return false;
    }

    try {
        return mReactContext.hasActiveCatalystInstance();
    } catch (Exception e) {
        return mReactContext.hasActiveReactInstance();
    }
}

still gave me the same error, I had to change it back to:

@Override
public synchronized boolean isReactInitialized() {
    if (mReactContext == null) {
        return false;
    }

    return mReactContext.hasActiveCatalystInstance();
}

on my fork.
PS.: I am not a java developer in any shape form or fashion, it is entirely possible that I did something wrong.

@Arkan4ik
Copy link

Arkan4ik commented May 29, 2022

@luizppa have you solved this issue?

@luizppa
Copy link

luizppa commented May 29, 2022

@luizppa have you solved this issue?

Yes, you can check out the result in this fork. It also has some other modifications, so I wouldn't recommend using it without checking the diff to the original repository.

This is the commit specifically.

@Arkan4ik
Copy link

@luizppa have you solved this issue?

Yes, you can check out the result in this fork. It also has some other modifications, so I wouldn't recommend using it without checking the diff to the original repository.

This is the commit specifically.

@luizppa yep, I also used it according to deprecation. Seems like need to upgrade react native version for support that method. Thank you for fast response!
image

https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java

Lunziyuan pushed a commit to NeyberTech/react-native-notifications that referenced this issue Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants