Flutter: Assorted Notes

Just a few useful notes about Flutter I want to remember:

Update NPM on Windows:

  1. Open PowerShell as Administrator
  2. Run: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  3. Run: npm install -g npm-windows-upgrade
  4. Run: npm-windows-upgrade

Update Android app APK version:

  1. Go to android/app/build.gradle
  2. Increment the versionCode found inside the defaultConfig settings
  3. Update the versionName accordingly

Add Flutter to Mac Path:

  1. Find where the Flutter SDK is located
  2. Open your bash profile, i.e. sudo vi ~/.bash_profile
  3. Add the following: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
  4. Save changes

Change Package Name for an Existing app:

  1. Go to your AndroidManifest.xml file
  2. Change the label name:
    <application
    android:name="io.flutter.app.FlutterApplication"
    android:label="[APP_NAME]"
  3. Change the package name:
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="your.package.name">
  4. Then go to your android/app/build.gradle file
  5. Update the applicationId found inside the defaultConfig settings
  6. with the package name:
    defaultConfig { applicationId "your.package.name" }
  7. And finally, go to the MainActivity.java file:
    package your.package.name;

Change Package Name for a New app:

  1. Run: flutter create --org com.yourdomain appname
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.