Error running adb: Error running app. Error: Activity not started, unable to resolve Intent

14k views Asked by At

Hi I am trying to run 'yarn android' on my react-native project. And am running into the following error:

yarn android v0.27.5
$ react-native-scripts android
10:37:45 AM: Starting packager...
10:39:34 AM: Starting Android...
10:39:37 AM: Packager started!

To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.

    <QR CODE>                                                  

Or enter this address in the Expo app's search bar:

  exp://172.19.29.31:19000

Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit https://expo.io.


    Logs from serving your app will appear here. Press Ctrl+C at any time to stop.

Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://172.19.29.31:19000 flg=0x10000000 }

(node:28009) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null

I used the create-react-native-app generator to setup my app and here is my project structure:

<username>$ls
App.js          app.json        gen         package.json
App.test.js     assets          my-app-key.keystore stylesheet.js
README.md       components      node_modules        yarn.lock 

I also tried scanning the qr code with my expo app to run my app on my phone but it goes to 100% and then crashes out of the app, or it gives the dark blue screen in which the error is "Uncaught Error" Packager is not running at http::19003" (even if the port I scan is http:19000).

I also just now tried running 'npm start' and then 'a' for the android option but am getting the message: 11:40:20 AM: Starting Android...

Error running adb: Error running app. Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=exp://172.19.29.31:19000 flg=0x10000000 }


 › Press a to open Android device or emulator, or i to open iOS emulator.
 › Press q to display QR code.
 › Press r to restart packager, or R to restart packager and clear cache.
 › Press d to toggle development mode. (current mode: development)

(node:31496) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'length' of null
11:43:30 AM: Running app on SM-T560NU in development mode

11:44:01 AM: [sane] Warning: Lost connection to watchman, reconnecting..

Can anyone help me with this issue?

8

There are 8 answers

0
Duclearc On

Solved it by using the Pixel 5 emulator (Android 11 R - API 30) instead of the default Pixel 3a. I'm on a MacBook Pro 2021 M1 Max (macOS Monterrey 12.3)

  1. First (assuming you have your emulators at the default location) open your ~/.zshrc, and add the following somewhere in it (preferably at the bottom, if you're not sure where):
export PATH=$PATH:~/Library/Android/sdk/emulator/
  1. Then open Android Studio and click on "More Actions" and then on "Virtual Device Manager" Virtual Device Manager on Android Studio
  2. That will open a new "Device Manager" window. Click on the "Create device" button on it's top-left corner
  3. This will open yet another window with a list of devices. Select "Pixel 5" (the row will turn blue) and the click on "Next" (bottom-right corner) Select "Pixel 5"
  4. Download the software you need. I'm using Android 11 R and am ignoring the rest. You can see my settings bellow. This image is the state you want to get to after all downloads are done (each download will open a new window. When it's done, just click on "Finish" in the bottom-right corner). When you see the same as shown bellow, you can click on "Next" (bottom-left corner). download the necessary software
  5. On the next screen, I highly recommend renaming the AVD to an name that's easier to type. In my case it's "pixel5". Then click on "Finish". You can then close enter image description here
  6. Once all that is done you can check if your emulator and the PATHs are set up properly by opening a Terminal window/tab and typing the bellow command. You should see a list with all your AVDs (including the name you've set on step 7.
emulator -list-avds
  1. Assuming the AVD you've just created is there, you can start it by typing "emulator + [space] + @ + yourAvdName". In my case:
emulator @pixel5
  1. This will start the emulator (if you have multiple Desktops, look around. Sometimes I've had it opening on the "not-visible" desktop on Mac.
  2. Now, open a new Terminal window/tab and navigate to your react-native project.
  3. Start the android environment with:
expo start --android

or

npm run android

Now just wait. Give it some time to download and start the expo app, then it should start automatically.‍

0
salih kallai On

make sure you are using minimal API 19 on your emulator, its work on me somehow.

0
Nghi Nguyen On

Try to remove the apk

rm -rf ~/.expo/android-apk-cache

Source: https://www.bountysource.com/issues/43329081-error-staring-android-emulator

0
Henry J. Perez On
adb uninstall <package_name>

I had a similar problem and I solved it by uninstalling the app on the device.

Couldn't start project on Android: Error running adb: 
Error running app. Error: 
Activity not started, unable to resolve Intent 
{
 act=android.intent.action.VIEW
 dat=<package_name>://expo-development-client/?url=http://172.16.0.5:8081 flg=0x10000000 
}

If you don't know the exact name of the package, you can use this command to list the exact name of the package:

adb shell pm list packages | grep <clue_of_the_name>

I hope it helps. This was an answer I saw in: Android Studio : How to uninstall APK (or execute adb command) automatically before Run or Debug?

A bit of explanation of why this worked for me so you can take it into account

The explanation of why this works on my case it's because I had the app installed on the physical device, I uninstalled it and then I wasn't able to run de app again because the old one was blocking it from installing the app again in the device

0
Utsav Barnwal On

If you have created the emulator from Android Studio's AVD, make sure that you have created one with PlayStore support.

Choose the one with the PlayStore icon next to it.

enter image description here

This was the issue in my case.

0
Hassan Jamil On

Specs:

  • Macbook pro 14, M1, 16GB, 512GB
  • npm version 8.1.2
  • expo version 5.0.3

It may work for you, but I got a solution doing it that's why posting it as the answer.

The thing you can do is, simply clear your apps running in emulator tasks including Expo Go App, then open Expo Go App, Clear your application from it, and try to run it again using these commands npm start or npm run android or npm run ios.

I hope it will work for you too.

0
danb4r On

Pre-build clean-up before proceding any new build process (more here: Expo stuck on "Config syncing" while ejecting to expokit)

$ npx expo prebuild --clean

Build and run on Android first time (more here: https://docs.expo.dev/development/build/#locally-with-xcode-and-android-studio)

$ npx expo run:android

Next development runs can be done with (more here: https://docs.expo.dev/development/getting-started/#developing-your-app)

$ npx expo start --dev-client

0
Paja Aleksic On

you probably need to reinstall the android app, you can do it with expo install:android then try opening it again