Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Android: WorkletsPackage class name collision with react-native-worklets on RN 0.83+

Aperta
#266 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
android, java, kotlin, react-native

Direzione di ricerca

Start by locating the Android WorkletsPackage declaration and its references, then review the react-native.config.js and MainApplication.kt workaround alongside the generated PackageList.java error. Rename the class and update its references so react-native-worklets-core and react-native-worklets can autolink together on React Native 0.83+ without ambiguous imports.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

On React Native 0.83+, react-native-worklets-core fails to compile on Android due to a class name collision with react-native-worklets (Reanimated 4 dependency).

Both packages export a class named WorkletsPackage, causing autolinking to generate ambiguous imports in PackageList.java.

Environment

  • React Native: 0.83.1
  • react-native-worklets-core: 2.0.0-beta.4
  • react-native-worklets: 0.7.2 (peer dependency of Reanimated 4.2.1)
  • react-native-vision-camera: 4.7.3
  • react-native-reanimated: 4.2.1

Error

error: a type with the same simple name is already defined by the single-type-import of WorkletsPackage
import com.margelo.worklets.WorkletsPackage;
                   ^
/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:86: error: reference to WorkletsPackage is ambiguous

Root Cause

  • react-native-worklets: com.swmansion.worklets.WorkletsPackage
  • react-native-worklets-core: com.margelo.worklets.WorkletsPackage

RN 0.83's stricter autolinking generates both imports, causing Java compilation failure.

Workaround

Exclude react-native-worklets-core from autolinking and manually register:

react-native.config.js:

module.exports = {
  dependencies: {
    'react-native-worklets-core': {
      platforms: { android: null }
    }
  }
};

MainApplication.kt:

PackageList(this).packages.apply {
  add(com.margelo.worklets.WorkletsPackage())
}

Proposed Fix

Rename the Java class to avoid collision:

  • WorkletsPackage → WorkletsCorePackage

This would align with the package name and prevent conflicts with Software Mansion's react-native-worklets.

Additional Context

  • This only affects RN 0.83+ (confirmed working on RN 0.81.5)
  • Both packages are required (VisionCamera needs worklets-core, Reanimated needs worklets)
  • No JSI/C++ collision — purely Android autolinking issue
  • The two packages coexist fine at the native layer (different C++ namespaces)
Lingua principale
C++
Stelle
791
Fork
65
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di margelo/react-native-worklets-core

Tutte le issue di margelo/react-native-worklets-core

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.