I am creating an android app and currently have my environment variables as described in the docs “Installing app variants on the same device”.
my app.config.js looks like the docs:
const IS_DEV = process.env.APP_VARIANT === 'development';
export default {
// You can also switch out the app icon and other properties to further
// differentiate the app on your device.
name: IS_DEV ? 'MyApp (Dev)' : 'MyApp',
slug: 'my-app',
ios: {
bundleIdentifier: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
},
android: {
package: IS_DEV ? 'com.myapp.dev' : 'com.myapp',
},
};
I also have an android folder generated from expo prebuild.
I have two issues:
When I build, the app name remains the same irrespective of environment and I cannot install different environment apps at the same time in my phone.
How do I run APP_VARIANT=development expo start ? It always gives an error:
OK, I suspect you’ll need to run npx expo prebuild --clean to regenerate the native projects whenever you change the APP_VARIANT environment variable. Or else you will need to follow the " In bare project" part of the docs.
Note: Running npx expo prebuild --clean will delete and regenerate the android and ios directories. So if you’ve made any changes in there, you might want to save them and re-apply them afterwards or something like that.
Can I ask why you ran npx expo prebuild?
Are you running PowerShell? I suspect that’s where that ugly error message is coming from
That way of running a command will only work on Unix/macOS. On Windows you would need to do this:
Ah yes, it won’t work if you’re using prebuild. If you’ve run prebuild you should rather follow the “bare workflow” instructions, because that’s essentially what you have.
Thank you very much sir. It worked just as you said. Just one more thing before I go.
How do I start the variant server using the shortcut. My script looks like this in my package.json
Once again, I am really grateful. You have saved me hours of search. Wish the docs were a bit more detailed for me to understand.
Is there a way I can give you a star on here for all the help. I am not too familiar with hos this works
EDIT:
Was able to just use yarn run liveTest and it worked. Thanks For everything.