Android: share-to-app crashes instantly (ShareActivity ClassNotFoundException) #17

Closed
opened 2026-09-01 16:52:53 +00:00 by mohlec · 1 comment
Owner

Sharing anything into the app from another app crashes on launch, 100% of the time on Android.

java.lang.RuntimeException: Unable to instantiate activity
  ComponentInfo{com.ncwcom.slash/com.ncwcom.slash.ShareActivity}
Caused by: java.lang.ClassNotFoundException: Didn't find class
  "com.ncwcom.slash.ShareActivity"

Cause. android/app/src/main/AndroidManifest.xml declares the share target as
com.ncwcom.slash.ShareActivity, but the class is vendored in the rnshare library as
com.mattermost.rnshare.ShareActivity
(libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareActivity.kt).
No such class exists in the APK. Introduced by 715ad89dc, which renamed
com.mattermost.* to com.ncwcom.slash across the manifest and caught this library class
name along with the app's own. Upstream declares the library path here.

Because the intent filter still registers, the app appears in the system share sheet and
then dies when picked, so it reads to users as "sharing to the app is broken" rather than
as a missing feature.

Fix. One line: point android:name back at com.mattermost.rnshare.ShareActivity.
android:taskAffinity can stay as-is (an affinity string, not a class), and
MattermostShareImpl compares getCurrentActivityName() against the simple name
"ShareActivity", which is unaffected.

Observed: 2026-08-31, SM-S938U / Android 16, app v1.0.0+1.

Impact: low frequency, since sharing in is uncommon, but a hard 100% failure when tried.

Sharing anything into the app from another app crashes on launch, 100% of the time on Android. ``` java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ncwcom.slash/com.ncwcom.slash.ShareActivity} Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ncwcom.slash.ShareActivity" ``` **Cause.** `android/app/src/main/AndroidManifest.xml` declares the share target as `com.ncwcom.slash.ShareActivity`, but the class is vendored in the rnshare library as `com.mattermost.rnshare.ShareActivity` (`libraries/@mattermost/rnshare/android/src/main/java/com/mattermost/rnshare/ShareActivity.kt`). No such class exists in the APK. Introduced by `715ad89dc`, which renamed `com.mattermost.*` to `com.ncwcom.slash` across the manifest and caught this library class name along with the app's own. Upstream declares the library path here. Because the intent filter still registers, the app appears in the system share sheet and then dies when picked, so it reads to users as "sharing to the app is broken" rather than as a missing feature. **Fix.** One line: point `android:name` back at `com.mattermost.rnshare.ShareActivity`. `android:taskAffinity` can stay as-is (an affinity string, not a class), and `MattermostShareImpl` compares `getCurrentActivityName()` against the simple name `"ShareActivity"`, which is unaffected. **Observed:** 2026-08-31, SM-S938U / Android 16, app v1.0.0+1. Impact: low frequency, since sharing in is uncommon, but a hard 100% failure when tried.
Author
Owner

Upstream context for the eventual rebase

Fixed by #21 (merged). Recording the rebase implications while they are fresh.

The fork point is 1e169c78 (2026-04-15); upstream has moved 55 commits since, dominated by
b6fc85385 "Migrate from RNN to Expo router" (1281 files, +51.9k/-38.6k), which also carries
React Native 0.77.3 -> 0.83.9 with New Architecture enabled, React 19, Expo SDK 55,
TypeScript 6, reanimated 4, and compileSdk/targetSdk 35 -> 36.

This fix survives the rebase. That commit does touch android/app/src/main/AndroidManifest.xml,
but not the ShareActivity declaration -- its manifest change removes RNN's
com.reactnativenavigation.controllers.NavigationActivity. So the one-line correction here does
not conflict.

One thing to re-test after the rebase: b6fc85385 includes a "library rnshare android new arch
support fix" and rewrites MattermostSharePackage.kt. The share path should be exercised
end-to-end on device again at that point (share a photo from the gallery, confirm the compose
sheet opens), since the failure mode this issue covers was a runtime class-resolution gap that
static checks cannot fully close.

### Upstream context for the eventual rebase Fixed by #21 (merged). Recording the rebase implications while they are fresh. The fork point is `1e169c78` (2026-04-15); upstream has moved 55 commits since, dominated by `b6fc85385` "Migrate from RNN to Expo router" (1281 files, +51.9k/-38.6k), which also carries React Native 0.77.3 -> 0.83.9 with **New Architecture enabled**, React 19, Expo SDK 55, TypeScript 6, reanimated 4, and compileSdk/targetSdk 35 -> 36. **This fix survives the rebase.** That commit does touch `android/app/src/main/AndroidManifest.xml`, but not the `ShareActivity` declaration -- its manifest change removes RNN's `com.reactnativenavigation.controllers.NavigationActivity`. So the one-line correction here does not conflict. **One thing to re-test after the rebase:** `b6fc85385` includes a "library rnshare android new arch support fix" and rewrites `MattermostSharePackage.kt`. The share path should be exercised end-to-end on device again at that point (share a photo from the gallery, confirm the compose sheet opens), since the failure mode this issue covers was a runtime class-resolution gap that static checks cannot fully close.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-mobile#17
No description provided.