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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶 [BUG] A problem occurred evaluating & configuring project ':react-native-android-notification-listener'. #42

Closed
1 task done
joey-kwl opened this issue Apr 21, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@joey-kwl
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npx react-native run-android will crash when trying to compile/build react-native-android-notification-listener

React 17.0.2
React-native 0.68.1
react-native-android-notification-listener ^4.0.2

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '\node_modules\react-native-android-notification-listener\android\build.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':react-native-android-notification-listener'.     
> multiple points
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-android-notification-listener'.    
> compileSdkVersion is not specified. Please add it to build.gradle

Expected Behavior

To compile without crashing.

Steps To Reproduce

  1. npx react-native init <project_name>
  2. cd <project_name>
  3. npm install react-native-android-notification-listener
  4. npx react-native run-android

Library version that you are testing

4.0.2

Device

Android Emulator

Android Version

Android 11

Anything else?

No response

@joey-kwl joey-kwl added the bug Something isn't working label Apr 21, 2022
@joey-kwl
Copy link
Author

joey-kwl commented Apr 22, 2022

It seems to be working now. Changed nothing, but I have another problem. I can't request "permissions"

After pressing the request permission button I get: TypeError: Cannot read properties of undefined (reading 'requestPermission')

const handleOnPressPermissionButton = async () => {
    try {
      RNAndroidNotificationListener.requestPermission()

    } catch(e) {
      console.log(e)
    }
  }

import RNAndroidNotificationListener from 'react-native-android-notification-listener' = undefined

@leandrosimoes
Copy link
Owner

Hi @chineseouchie.

Maybe is still something related to the compileSdkVersion problem. What did you do to fix the problem?

@joey-kwl
Copy link
Author

I use npx react-native start instead of npx react-native run-android

@leandrosimoes
Copy link
Owner

@chineseouchie

Yes, that's why you are getting undefined in the RNAndroidNotificationListener.
The run-android command builds/compiles the application and its libraries.
The start command just runs the javascript bundler to bundle and sync the javascript code with the emulator/device.

With no success in the run-android command, the application will not be compiled so the problem still is the compileSdkVersion problem pointed out before.

I'm investigating but I think that is something related to the last version of react-native or the Gradle version that it uses.

@leandrosimoes
Copy link
Owner

@chineseouchie

Problem solved and a new version 4.1.0 released.
Uninstalling the last 4.0.2 version and installing this new 4.1.0 version should solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants