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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error type 3 Error: Activity class {....} does not exist #2349

Open
eidan66 opened this issue Apr 2, 2024 · 2 comments
Open

Error type 3 Error: Activity class {....} does not exist #2349

eidan66 opened this issue Apr 2, 2024 · 2 comments

Comments

@eidan66
Copy link

eidan66 commented Apr 2, 2024

Environment

 System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 248.00 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.5
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: XXX/.gem/ruby/3.3.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: XXX/.rubies/ruby-3.3.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.5
    wanted: 0.73.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

npx react-native doctor
Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ npm - Required to install NPM dependencies
 ✓ Watchman - Used for watching changes in the filesystem when in development mode
 ✓ Metro - Required for bundling the JavaScript code

Android
 ✓ Adb - Required to verify if the android device is attached correctly
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✓ Android SDK - Required for building and installing your app on Android

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ Ruby - Required for installing iOS dependencies
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI
 ✓ .xcode.env - File to customize Xcode environment

Errors:   0
Warnings: 0

Description

I Updated namespace and applicationId to be the same name (after we initiate the project and change the name), after it i ran npm run android i'm getting this error message and the app won't open automatically
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=XX.XXX.XXXX/.MainActivity } Error type 3 Error: Activity class {XX.XXX.XXXX/XX.XXX.XXXX.MainActivity} does not exist.

XX.XXX.XXXX = my package name

Reproducible Demo

I can't share the code..

/adb -s 2A291FDH200865 shell am start -n XX.XXX.XXXX/XX.XXX.XXXX.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=XX.XXX.XXXX/.MainActivity }
Error type 3
Error: Activity class {XX.XXX.XXXX/XX.XXX.XXXX.MainActivity} does not exist.
// android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
        
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- Include this only if you are planning to use the camera roll -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="true"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.RUN"/>
        </intent-filter>
        <intent-filter android:label="WatchTower" android:autoVerify="true">
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="https" android:host="cpwt.page.link" />
        </intent-filter>
        <intent-filter android:label="WatchTower" android:autoVerify="true">
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="https" android:host="XXXXXXX" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data
          android:name="com.google.mlkit.vision.DEPENDENCIES"
          android:value="barcode" />
    </application>
</manifest>

//android/app/build.gradle

.... some code...

android {
    ndkVersion rootProject.ext.ndkVersion

    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace 'XX.XXX.XXXX'
    defaultConfig {
        applicationId 'XX.XXX.XXXX'


...rest of the code...

I have try those things before open this ticket:
https://stackoverflow.com/questions/20915266/error-type-3-error-activity-class-does-not-exist
#2269 (and it already install by react native community by the versions on my project)
./gradlew clean -> npm run android -> same error
removing build folder -> same error

BUILD SUCCESSFUL in 2m 9s
771 actionable tasks: 766 executed, 5 up-to-date
info Connecting to the development server...
debug Running command "XXX/adb -s 2A291FDH200865 reverse tcp:8081 tcp:8081"
info Starting the app on "2A291FDH200865"...
debug Running command "/XXX/adb -s 2A291FDH200865 shell am start -n XX.XXX.XXXX/XX.XXX.XXXX.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER"
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=XX.XXX.XXXX/.MainActivity }
Error type 3
Error: Activity class {XX.XXX.XXXX/XX.XXX.XXXX.MainActivity} does not exist.
error Failed to start the app.
Error: Command failed with exit code 1: XXX/adb -s 2A291FDH200865 shell am start -n XX.XXX.XXXX/XX.XXX.XXXX.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    at makeError (XXX/node_modules/execa/lib/error.js:60:11)
    at module.exports.sync (/XXX/node_modules/execa/index.js:194:17)
    at tryLaunchAppOnDevice (/XXX/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22)
    at XXX/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:93:39
    at Array.forEach (<anonymous>)
    at runOnAllDevices (/XXX/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:88:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.handleAction (XXX/node_modules/@react-native-community/cli/build/index.js:118:9)
@ofirmc
Copy link

ofirmc commented Apr 2, 2024

The issue also accrues on my app.
Help please!

@mikehardy
Copy link
Contributor

I had something similar but a slightly different error message - so careful! - this may not apply - however, this PR may be of interest - either it or something like it may work for you? #2388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants