Code Monkey home page Code Monkey logo

Comments (13)

Ehesp avatar Ehesp commented on June 18, 2024 2

Inside of node_modules/@notifee/react-native/android/build.gradle, comment out the lines:

   debugImplementation("com.facebook.flipper:flipper:0.23.5") {
     exclude group:'com.facebook.yoga'
     exclude group:'com.facebook.flipper', module: 'fbjni'
     exclude group:'com.facebook.litho', module: 'litho-annotations'
   }

Sorting that in a release soon :)

from react-native-notifee.

mikehardy avatar mikehardy commented on June 18, 2024 1

I think this is a problem with build tools being out of date based on my quick googling https://stackoverflow.com/questions/48427655/cannot-find-symbol-method-metafactory-using-lambda

Are you sure you have Java 8 as your build JDK, you have enabled JDK_1_8 in gradle, and you have build tools 28 for your project? "default typescript template" is located where (a URL) so maybe we could try to reproduce? I imagine if you use the default react-native-firebase template or the default react-native template it would work, have you tried that as a comparison?

from react-native-notifee.

mikehardy avatar mikehardy commented on June 18, 2024 1

This is what I mean by JDK_1_8 - https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle#L126

I haven't checked out the typescript template but that's great that it exists etc - I use + love typescript myself so if I was starting over I'd do that

For this though, I'd definitely try the default (non-typescript) template to see if it works, and if it does not then the problem is in the template and the PR will go there

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

Template is react-native-template-typescript as mentioned in React Native, Getting Started https://facebook.github.io/react-native/docs/getting-started
I did check the JDK version to be 8. I'll check build tools version tomorrow. They could be outdated!
Not sure what you mean by enable JDK_1_8 in Gradle though.

from react-native-notifee.

Salakar avatar Salakar commented on June 18, 2024

We've got this running in an app using the TypeScript template so I'm not sure its the template specifically, probably related what you said @mikehardy,

Try add the block @mikehardy suggested to your gradle file; https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle#L126

cc @Ehesp - don't think we added anything special on the demo app after the TS template init?

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

I have that compileOptions block. So that shouldn't be the issue.
Guess I can add that I am on Arch Linux and have not installed Android Studio. These are my installed Android SDK versions:
I can also add that I haven't had any issues, with this install, on a previous project, but that is a year ago now.

local/android-platform 29_r04-1
    Android SDK Platform, latest API
local/android-platform-28 9_r06-1
    Android SDK Platform, API-28
local/android-sdk 26.1.1-1
    Google Android SDK
local/android-sdk-build-tools r29.0.3-1
    Build-Tools for Google Android SDK (aapt, aidl, dexdump, dx, llvm-rs-cc)
local/android-sdk-build-tools-28 r28-1
    Build-Tools for Google Android SDK (aapt, aidl, dexdump, dx, llvm-rs-cc)
local/android-sdk-platform-tools 29.0.5-1
    Platform-Tools for Google Android SDK (adb and fastboot)

I pushed my setup to a repo here: https://gitlab.com/Jomik/fitnessapp/-/tree/feature/notifications
Literally no changes other than removing the react-native start screen in App.tsx, moving App.tsx into src, and then adding notifee.
master builds just fine for me, feature/notifications does not.

from react-native-notifee.

Ehesp avatar Ehesp commented on June 18, 2024

What version of Java is running? That's a lambda expression it erroring on, which requires 8.

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

It should be Java 8:

➜ archlinux-java status
Available Java environments:
  java-11-openjdk
  java-13-openjdk
  java-8-openjdk (default)
➜ archlinux-java get
java-8-openjdk
➜ javac -version
javac 1.8.0_242

I switched to Java 13, which gives a different error:

/home/jomik/projects/fitnessapp/node_modules/@notifee/react-native/android/src/main/java/io/invertase/notifee/NotifeeReactUtils.java:103: error: cannot find symbol
          new Handler(Looper.getMainLooper()).postDelayed(callback::call, 100);
                                                          ^
  symbol:   method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)
  location: interface LambdaMetafactory
1 error
Fatal Error: Unable to find method metafactory

FAILURE: Build failed with an exception.

Have you tried to clone my repository to see if the error happens for you? Just to be 100% sure it is my set up that is broken.

EDIT: Apparently the above error is also what I am getting on Java 8 now...

from react-native-notifee.

Ehesp avatar Ehesp commented on June 18, 2024

I don't have access to clone it.

If you open Android Studio and go to SDK manager, is everything up to date?

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

platform-tools is a bit outdated is all, I have 29.0.1 and 29.0.5 is latest, but 29.0.5 isn't available in AUR yet I guess.
I don't think platform-tools influences building either. These are my versions as reported by sdkmanager

➜ sdkmanager --list        
Installed packages:             
  Path                                        | Version | Description                                | Location                                    
  -------                                     | ------- | -------                                    | -------                                     
  build-tools;28.0.0                          | 28.0.0  | Android SDK Build-Tools 28                 | build-tools/28.0.0/                         
  build-tools;28.0.3                          | 28.0.3  | Android SDK Build-Tools 28.0.3             | build-tools/28.0.3/                         
  build-tools;29.0.3                          | 29.0.3  | Android SDK Build-Tools 29.0.3             | build-tools/29.0.3/                         
  emulator                                    | 29.3.4  | Android Emulator                           | emulator/                                   
  patcher;v4                                  | 1       | SDK Patch Applier v4                       | patcher/v4/                                 
  platform-tools                              | 29.0.1  | Android SDK Platform-Tools 29.0.1          | platform-tools/                             
  platforms;android-28                        | 6       | Android SDK Platform 28, rev 6             | platforms/android-28/                       
  platforms;android-29                        | 4       | Android SDK Platform 29, rev 4             | platforms/android-29/                       
  system-images;android-28;google_apis;x86    | 9       | Google APIs Intel x86 Atom System Image    | system-images/android-28/google_apis/x86/   
  system-images;android-28;google_apis;x86_64 | 9       | Google APIs Intel x86 Atom_64 System Image | system-images/android-28/google_apis/x86_64/
  tools                                       | 26.1.1  | Android SDK Tools 26.1.1                   | tools/                                      

EDIT: Found this: https://stackoverflow.com/questions/45452827/lambda-expression-in-android-library-module-not-working

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

SO! I had a broken build-tools-28.0.3 install. Manually deleted it and reinstalled.
This gives me an entirely new issue though...

➜ yarn android --verbose
yarn run v1.22.0
$ react-native run-android --verbose
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 879 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
debug Running command "cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081"

> Configure project :@notifee_react-native
:@notifee_react-native package.json found at /home/jomik/projects/fitnessapp/node_modules/@notifee/react-native/package.json
:@notifee_react-native:version set from package.json: 0.1.0 (0,1,0 - 1000)
:@notifee_react-native:android.compileSdk using custom value: 29
:@notifee_react-native:android.targetSdk using custom value: 29
:@notifee_react-native:android.minSdk using custom value: 16
:@notifee_react-native:reactNativeAndroidDir /home/jomik/projects/fitnessapp/node_modules/react-native/android

> Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
42 actionable tasks: 2 executed, 40 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/x86/libc++_shared.so'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/x86/libc++_shared.so'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

    at checkExecSyncError (child_process.js:611:11)
    at execFileSync (child_process.js:629:15)
    at runOnAllDevices (/home/jomik/projects/fitnessapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/home/jomik/projects/fitnessapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at /home/jomik/projects/fitnessapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Command.handleAction (/home/jomik/projects/fitnessapp/node_modules/@react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

from react-native-notifee.

Jomik avatar Jomik commented on June 18, 2024

Oh, awesome.
I actually managed to solve it by adding

android {
   ...
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    }
   ...
}

You can close this issue 👍 Unless you want to keep it open until the above fix is done.

from react-native-notifee.

Salakar avatar Salakar commented on June 18, 2024

This has been fixed in the latest release, thanks!

from react-native-notifee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.