"App not installed" error after building android app with "expo build:android" - react-native

after I ran expo build:android i got the apk file built successfully but when I try to install it in many devices, it is not being installed and it shows "App not installed" error [image].
here is my package.json:
{
"name": "some-app",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.18.0",
"expo": "^31.0.2",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
"react-navigation": "^3.1.2",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-persist": "^5.10.0"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
}
}

the problem was in the android packager name in my app.json
so it was like that:
"package": "com.<myName>.<appName>"
i replaced myName with the appName like that :
"package": "com.<appName>.<appName>"
and it worked like a magic and I was able to successfully build and install the app on multiple devices

Make sure to uninstall any previous version of the App installed as they may have the same package name.

On your main screen of the phone, scroll down the status bar of the phone.
Select the “Airplane Mode”, and press “Turn ON”
Now go and try to install your application
While installing a notification may appear about “Blocked by Play Protect”
Then press “Install anyway”

The solution for me was the disk space of my phone.
Solution:
-> Try to uninstall some apps and after this try to install. ;-) worked fine for me

Those two solutions didn't make it for me. What made it for me was just to install the last Os on my phone and the apk install finally worked. Hope my answer can help someone as it took me a long time to find out why.

Also check if your mobile device has space. I cleared up about 2GB of dummy data on my device and the app installed.

Related

Run React Native application for Windows without launching Metro

I have tried below steps to publish my React Native application for windows:
Open the solution in Visual Studio
Select the Release configuration from the Configuration Manager drop-down.
Build the solution. You can now launch without first launching Metro.
If you want to build an APPX package to share or publish, use the Project > Publish > Create App Packages... option.
Took reference from [https://microsoft.github.io/react-native-windows/docs/getting-started]
I have used below command to create my react-native application:
npx react-native init {projectName} --template react-native#^0.71.0
cd {projectName}
npx react-native-windows-init --overwrite
npx react-native run-windows
Here is my package.json looks like:
{
"name": "SampleRNApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"windows": "react-native run-windows"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.71.0",
"react-native-windows": "0.71.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/preset-env": "^7.14.0",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^3.0.0",
"#tsconfig/react-native": "^2.0.2",
"#types/jest": "^29.2.1",
"#types/react": "^18.0.24",
"#types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.5",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4",
"metro-config": "^0.73.7"
},
"jest": {
"preset": "react-native"
}
}
Observations:
For building the app it takes a hell lot of time (more than 30 mins) and after completing build successfully I'm not able to launch my RN application without Metro. It gives me error "A connection with the server could not be established" (see below error screen-shot).
System specs: I'm using Windows 11 OS and Visual Studio 2022 professional
After publishing I see there is an react-native application automatically installed into my system with the same name of my application and upon double clicking it I'm getting same error.
Error screen-shot:
error screen-shot
Could you please advice me how we can create React Native application for Windows project, standalone package which will work without explicitly running Metro (without running npm start command).
Thanks in advance!

Object is not a function in Expo(react-native) app

My App is not starting. Please help me. Is that the problem with the libraryies ot with the code?
edit 1:
another mistake when doing render
Error: Problem validating fields in app.json. See https://docs.expo.io/workflow/configuration/
• should NOT have additional property 'nodeModulesPath'.
app.json file:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#expo/vector-icons": "^12.0.4",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/bottom-tabs": "^5.11.10",
"#react-navigation/native": "^5.9.4",
"expo": "~41.0.1",
"expo-status-bar": "~1.0.4",
"firebase": "^8.2.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.0.0",
"react-native-stack": "^1.0.0-alpha11",
"react-native-web": "~0.13.12",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4"
},
"devDependencies": {
"#babel/core": "^7.9.0"
},
"private": true
}
edit 2:
I uninstalled react-native-stack, but there is a mistake: Error: Module not found: Can't resolve 'react-native-stack'
I installed it again:
npm install react-native-stack
Then I have the same problem in the render (look the first picture) and this mistakes in console:
1 (yellow)
`Some of your project's dependencies are not compatible with currently installed expo package version:
- react-native-reanimated - expected version range: ~2.1.0 - actual version installed: ^1.13.2
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]`
2 (red)
`Error: Problem validating fields in app.json. See https://docs.expo.io/workflow/configuration/
• should NOT have additional property 'nodeModulesPath'.`
The render answer:
`√ Expo Webpack
Compiled successfully in 5.25s
i 「wds」: Project is running at http://0.0.0.0:19006/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from C:\Users\Лёха\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\webpack-config\web-default
i 「wds」: 404s will fallback to /
edit 3
I was wrong, so I deleted react-native-stack again
npm uninstall react-native-stack
Then I deleted the import in App.js file:
import {createStackNavigator} from 'react-native-stack'
I still have it in yarn.lock file, but I think rm -rf node_modules should work. I just don't understand, how to use it.
`
EDIT
you are probably not having react-native-screens in your node_modules? For react-navigation for each module you are using you have other modules that you need to import in addition. This is not done automatically.
old answer
You are using useScreens() outside of a component. By the way useScreens() is deprecated and should be replaced with enableScreens

Why am I suddenly having the webpack metro bundler instead of the normal metro bundler?

Forgive me if this sounds silly or obvious, but I have been working fine on my various projects using expo for a while now, but then all of a sudden, midway into my project, whenever I start the metro bundler using expo start and try running on android device, I suddenly get an error saying packager is not running at 19001, and whenever it happens, i notice the metro bundler is slightly different as shown below where it says "Starting webpack on port 19006 in development mode" Webpack metro bundler instead of the normal "Starting Metro Bundler on port 19001". But then when I try opening my previous projects using expo start or starting a brand new project, the error does not occur and the normal metro bundler shows up and everything works fine(at least initially)
This is the package.json of my current error project
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~38.0.1",
"expo-status-bar": "^1.0.0",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz",
"react-native-web": "~0.11.7",
"react-redux": "^7.2.0",
"redux": "^4.0.5"
},
"devDependencies": {
"#babel/core": "^7.8.6",
"babel-preset-expo": "~8.1.0"
},
"private": true
}
Any advice would be appreciated
webpack is used for web, metro is used for ios and android. hopefully one day one bundler will be usable for all platforms without any limitations, but for now this is needed.
I solved it. It was a blunder on my part. The issue was coming from my installation of redux. While installing redux, i used npm install redux instead of npm install --save redux. I had to uninstall redux and react-redux using npm uninstall --save redux react-redux and reinstalled them using npm install --save redux react-redux . Everything works fine now

Expo + React Native version mismatch error ( JavaScript version: 0.55.4, Native version: 0.57.1 )

I found lots of threads about this problem, but non of them helped me out.
So sorry for writing another thread for the same problem.
I am new to react-native and frankly packange.json is really painful for me to match version of dependencies.
My package.json file is as follows.
And, error message is
console.error: "React Native version mismatch.
JavaScript version: 0.55.4
Native version: 0.57.1
....."
I tried delete cache and node_modules and reinstall those things using following command.
"watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/haste-map-react-native-packager-* && rm -rf node_modules/&& npm install"
What I found from googling, in most cases, it was version mismatch between expo and react-native. But I believe I am using matched version of react-native and expo from expo website Here
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"babel-core": "^7.0.0-bridge.0",
"expo": "^30.0.0",
"native-base": "^2.8.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
"react-navigation": "^2.11.2"
},
"devDependencies": {
"#babel/core": "^7.1.6",
"regenerator-runtime": "^0.13.1"
}
}
It is better to check app.json file as well.
sdkVersion in app.json should be matched to your version.
run expo update. this will update all the dependencies in package .json to their latest most stable releases. this worked for me
Just check your package.json.
Your version of 'expo' and 'react-native' must match, and remove node_modules and package-lock.json
If you are using Expo,try to run expo update in your project directory
If using Expo CLI - try to run expo upgrade to upgrade the project packages and config (check that you do have the matching versions in package.json first)

Unrecognized command 'run-eject'

I want to eject my react-native so I can install mobx but running both 'yarn run eject' and 'npm run eject' doesn't work.i think this is new issue and so couldn't find help online. any help would be appreciated.
this is my package.json file and the error given below.
{
"name": "a2x",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-react-native-stage-0": "^1.0.1",
"jest": "^22.4.4",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest",
"eject": "react-native run-eject"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"axios": "^0.18.0",
"mobx": "^5.5.0",
"mobx-react": "^5.2.8",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-native-elements": "^0.19.1",
"react-navigation": "^2.0.1"
}
}
Try npm run eject..not npm run-eject
But if you trying to add native dependencies later i think better to start project using react native init. not using create-react-native-app.
Actual command is react-native eject.
It will create new folder for android and iOS to run it seperately on native.
As you said you are getting error of Both the iOS and Android folders already exist!, so please delete it and try with this command.
If you already have android and ios folder with some native implementation, there is no need to use eject command at all.
regarding npm run reject command, I guess this will be more useful to clear everything.
Always working for me, only follow two steps
first install in your project
yarn add react-native-eject
and then run
react-native eject
make sure you have install yarn in your pc