Migrated from React Native:
https://github.com/facebook/react-native/issues/22022
Thanks for importing this issue. Have you tried using --appId flag available for react-native run-android?
If yes, and it doesn't provide expected results, then it's something we should definitely fix.
@bartolkaruza, were you able to confirm if my suggestion fixes the issue?
Thanks for the reminder, just checked; works as documented and expected. Thanks a lot!
...
defaultConfig {
applicationId "com.flavorrunandroid"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
...
flavorDimensions "colors"
productFlavors {
blue {
applicationIdSuffix ".blue"
}
}
...
react-native run-android --variant=blueDebug --appId=com.flavorrunandroid.blue
I am having this same issue for a different scenario. We wanted to rename the root package as we had some issues with the playstore and now my react-native run-android don't work.
I renamed the files properly on android studio side and it builds without any error.
I changed the external.linked.project.id="com.yourstory.mobile" attribute of <Module> in the .iml file.
changed rootproject name in settings.gradle and still i couldnt run it.
So I used the --appId flag. Although the appId was detected correctly, it was searching for the MainActivity on the old folder which doesnt exist anymore
running react-native run-android --main-activity com.yourstory.mobile.MainActivity --appId com.yourstory.mobile and react-native run-android --main-activity MainActivity --appId com.yourstory.mobile
gave me
Starting the app (F:\Android_SDK/platform-tools/adb shell am start -n com.yourstory.mobile/com.yourstory.MainActivity..
Starting: Intent { cmp=com.yourstory.mobile/com.yourstory.MainActivity }
Error type 3
Error: Activity class {com.yourstory.mobile/com.yourstory.MainActivity} does not exist.
running react-native run-android --main-activity InvalidActivity --appId com.yourstory.mobile
also gave me
Starting the app (F:\Android_SDK/platform-tools/adb shell am start -n com.yourstory.mobile/com.yourstory.MainActivity...
Starting: Intent { cmp=com.yourstory.mobile/com.yourstory.MainActivity }
Error type 3
Error: Activity class {com.yourstory.mobile/com.yourstory.MainActivity} does not exist.
it looks like its not reading the --main-activity flag. Or maybe I'm doing it wrong. Pls someone guide me.
PS: the project was building the --appId flag was working fine
my package.json
{
"name": "yourstory-mobile",
"private": true,
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"storybook": "storybook start"
},
"rnpm": {
"assets": [
"./assets/fonts"
]
},
"dependencies": {
"apisauce": "^1.0.0",
"fontfaceobserver": "^2.0.13",
"immutable": "^4.0.0-rc.12",
"moment": "^2.22.2",
"moment-timezone": "^0.5.23",
"react": "16.3.1",
"react-instantsearch-native": "^5.3.2",
"react-lazy-load-image-component": "^1.1.5",
"react-lazyload": "^2.3.0",
"react-moment": "^0.8.3",
"react-native": "~0.55.2",
"react-native-config": "^0.11.5",
"react-native-cookies": "^3.3.0",
"react-native-dropdown-menu": "^2.0.0",
"react-native-elements": "^0.19.1",
"react-native-htmlview": "^0.13.0",
"react-native-image-picker": "^0.27.1",
"react-native-infinite-scroll-view": "^0.4.5",
"react-native-lazyload": "^1.1.0",
"react-native-loading-spinner-overlay": "^1.0.1",
"react-native-multiple-select": "^0.4.4",
"react-native-popup-menu": "^0.14.2",
"react-native-render-html": "^3.10.0",
"react-native-shadow": "^1.2.2",
"react-native-snap-carousel": "^3.7.5",
"react-native-svg": "^8.0.10",
"react-native-vector-icons": "^6.1.0",
"react-navigation": "^2.18.2",
"react-redux": "^5.1.0",
"redux": "^4.0.1",
"redux-saga": "^0.16.2",
"redux-thunk": "^2.3.0",
"ws": "^6.1.0"
},
"devDependencies": {
"@storybook/addon-actions": "^4.0.2",
"@storybook/addon-links": "^4.0.2",
"@storybook/addons": "^4.0.2",
"@storybook/react-native": "^4.0.2",
"babel-core": "^6.26.3",
"babel-jest": "^23.6.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"babel-runtime": "^6.26.0",
"eslint": "^5.10.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"jest": "^23.6.0",
"prop-types": "^15.6.2",
"react-dom": "16.3.1",
"react-test-renderer": "^16.6.0"
}
}
as per this comment , I checked the buildConfig file and the APPLICATION_ID is correct on that. I am out of all cards. someone pls help.
Hey @Ragzzy-R, you can check the following issue if it helps you: https://github.com/luggit/react-native-config/issues/194
Most helpful comment
Thanks for importing this issue. Have you tried using
--appIdflag available forreact-native run-android?If yes, and it doesn't provide expected results, then it's something we should definitely fix.