Change App Package Name for Flutter

Overview

Change App Package Name for Flutter

Change App Package Name with single command. It makes the process very easy and fast.

What It does?

  • Update AndroidManifest.xml files for release, debug & profile
  • Update build.gradle file
  • Update MainActivity file. Both java & kotlin supported.
  • Move MainActivity file to new package directory structure
  • Delete old package name directory structure.

How to Use?

Add Change App Package Name to your pubspec.yaml in dev_dependencies: section.

dev_dependencies: 
  change_app_package_name: ^1.1.0

Not migrated to null safety yet? use old version like this

dev_dependencies: 
  change_app_package_name: ^0.1.3

Update dependencies

flutter pub get

Run this command to change the package name.

flutter pub run change_app_package_name:main com.new.package.name

Where com.new.package.name is the new package name that you want for your app. replace it with any name you want.

Meta

Atiq Samtia– @AtiqSamtia[email protected]

Distributed under the MIT license.

https://github.com/atiqsamtia/change_app_package_name

Contributing

  1. Fork it (https://github.com/atiqsamtia/change_app_package_name/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request
Comments
  • ERROR:: Unknown Directory structure, both java & kotlin files not found.

    ERROR:: Unknown Directory structure, both java & kotlin files not found.

    Old Package Name: com.mithila.deliveryapp Updating build.gradle File Updating Main Manifest file Updating Debug Manifest file Updating Profile Manifest file

    ERROR:: Unknown Directory structure, both java & kotlin files not found.

    Get this log in terminal.

    bug 
    opened by nbnD 10
  • NoSuchMethodError: The method 'replaceAll' was called on null.

    NoSuchMethodError: The method 'replaceAll' was called on null.

    Hi,

    I have Flutter project and when I try to change bundleId I am getting following crash:

    Updating build.gradle File
    Updating Main Manifest file
    Updating Debug Manifest file
    Updating Profile Manifest file
    Project is using kotlin
    Updating MainActivity.kt
    Unhandled exception:
    NoSuchMethodError: The method 'replaceAll' was called on null.
    Receiver: null
    Tried calling: replaceAll("xxxxx__old_bundle_id___xxxxx", "xxxxx__new_bundle_id___xxxxx")
    #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
    #1      replaceInFile (package:change_app_package_name/file_utils.dart:5:23)
    <asynchronous suspension>
    #2      AndroidRenameSteps._replace (package:change_app_package_name/android_rename_steps.dart:78:11)
    #3      AndroidRenameSteps.updateMainActivity (package:change_app_package_name/android_rename_steps.dart:66:13)
    <asynchronous suspension>
    #4      AndroidRenameSteps.process (package:change_app_package_name/android_rename_steps.dart:40:11)
    <asynchronous suspension>
    #5      ChangeAppPackageName.start (package:change_app_package_name/change_app_package_name.dart:12:40)
    #6      main (file:///Users/josipbernat/Software/flutter/.pub-cache/hosted/pub.dartlang.org/change_app_package_name-0.1.2/bin/main.dart:4:24)
    #7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
    #8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
    pub finished with exit code 255
    
    opened by josipbernat 9
  • Error in android folders path in project with VGV CLI

    Error in android folders path in project with VGV CLI

    Hi great plugin. In VGV CLI created project the plugins can't find the MainActivity path, for Kotlin or java. The app package name change ok (in AndroidManifest) but the directory structure (MainActivity path) and the import in MainActivity not change. Thanks

    bug 
    opened by alejandrogiubel 4
  • Error after changing Name

    Error after changing Name

    Command I ran:- flutter pub run change_app_package_name:main SafeHome

    Error:-

    AILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:processDebugGoogleServices'.

    No matching client found for package name 'SafeHome'

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    BUILD FAILED in 17s Exception: Gradle task assembleDebug failed with exit code 1

    opened by Architjain12 4
  • Null check operator used on a null value

    Null check operator used on a null value

    I ran: flutter pub run change_app_package_name:main com.company.packageName it throws:

    Unhandled exception:
    Null check operator used on a null value
    #0      AndroidRenameSteps.process (package:change_app_package_name/android_rename_steps.dart:28:41)
    <asynchronous suspension>
    pub finished with exit code 255
    
    opened by brunodmn 2
  • Invalid argument(s) (input): Must not be null

    Invalid argument(s) (input): Must not be null

    Unhandled exception: Invalid argument(s) (input): Must not be null #0 _RegExp.firstMatch (dart:core-patch/regexp_patch.dart:221:24) #1 AndroidRenameSteps.process (package:change_app_package_name/android_rename_steps.dart:23:20) #2 ChangeAppPackageName.start (package:change_app_package_name/change_app_package_name.dart:12:40) #3 main (file:///Users/civelxu/.pub-cache/hosted/pub.flutter-io.cn/change_app_package_name-0.1.2/bin/main.dart:4:24) #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32) #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

    opened by CivelXu 1
  • [Question] after git clone a project

    [Question] after git clone a project

    git clone project flutter pub run change_app_package_name:main com.example.dev.frontend flutter run

    the above can run no problem

    But:

    git clone project myapp flutter pub run change_app_package_name:main com.example.dev.frontend flutter run <--- ERROR still looking for previous package

    opened by scheung38 1
  • The method 'group' was called on null.

    The method 'group' was called on null.

    jj@ind836 Web2App % flutter pub run change_app_package_name:main com.new.package.name Unhandled exception: NoSuchMethodError: The method 'group' was called on null. Receiver: null Tried calling: group(1) #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) #1 AndroidRenameSteps.process (package:change_app_package_name/android_rename_steps.dart:23:41) <asynchronous suspension> #2 ChangeAppPackageName.start (package:change_app_package_name/change_app_package_name.dart:12:40) #3 main (file:///Users/indianic/development/flutter/.pub-cache/hosted/pub.dartlang.org/change_app_package_name-0.1.2/bin/main.dart:4:24) #4 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32) #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

    opened by jayeshpansheriya 1
  • what happens to firebase app setup

    what happens to firebase app setup

    IF the firebase configuration for android and iOS is setup with old project name I suppose that have to be changed manually? Has anyone tried that? I have a huge setup and don't want things to break

    opened by jonathangull 1
  • Instance of '_StringStackTrace'pub finished with exit code 255

    Instance of '_StringStackTrace'pub finished with exit code 255

    Unhandled exception:
    FileSystemException: Directory listing failed, path = 'android/app/src/main/kotlin\*' (OS Error: The system cannot find the path specified.
    , errno = 3)
    Instance of '_StringStackTrace'pub finished with exit code 255
    
    opened by iamtechmanish 0
  • Manifest merger failed : Package name 'anything' at position AndroidManifest.xml:2:5-22 should contain at least one '.' (dot) character

    Manifest merger failed : Package name 'anything' at position AndroidManifest.xml:2:5-22 should contain at least one '.' (dot) character

    i never wanted to change the name manually , i am lazy , i thought maybe i should use this cool package and be done with it , well kill me lol .

    ps = my flutter app has 'com' in it not sure if it has anything to do with it , it was working fine with that name when i created the old app with the same name so i don't think its a naming convention thing ! , maybe a bug ? atiq bhai koi hal batayn .

    opened by wasiflamer 0
  • FAILURE: Build failed with an exception.

    FAILURE: Build failed with an exception.

    package _NewPackageName_
                            ^
    1 error
    
    FAILURE: Build failed with an exception.
    

    it need semicolon at the end of new java main activity

    opened by taheri79 0
  • Fixing .kt regex

    Fixing .kt regex

    Changing the regex pattern to ensure we only replace lines starting with package. Without this, we are replacing code like the following:

    class MainActivity: FlutterActivity() {
           override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
            super.configureFlutterEngine(flutterEngine)
    
            val applicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
            ...
        }
    }
    

    as it will replace the line after packageManager... for the new package name

    opened by adrinr 0
Owner
Atiq Samtia
Full Stack Developer working on a variety of tools and frameworks, some of these include WordPress, PHP, Laravel, Codeigniter, and Android & Flutter
Atiq Samtia
It's a universal app template to have a great animated splash screen and liquid slider. Just change the animation if you want (rive) and change the images or colours according to your app.

liquid A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

Zikyan Rasheed 28 Oct 7, 2022
Startup-Name-Generator-App-in-Flutter - Business Startup Name Generator App in Flutter

Business Startup Name Generator App #About APP: A simple mobile app that generat

AHSAN SIDDZ 0 Jan 30, 2022
Petrus Nguyễn Thái Học 193 Dec 29, 2022
ITS A SIMPLE CRYPTO APP THAT GIVES OR DISPLAYS PRICES - %CHANGE AND CHANGE VALUE OF TICKER (VARIOUS CRYPTO ASSERTS)

btcpricetracker A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

jatin upadhyay 0 Dec 28, 2021
A Fluter tabview that text color can change with animation and bg color change with animation

float_tab A Fluter tabview that text color can change with animation and bg color change with animation Getting Started This project is a starting poi

ventureli 1 Dec 8, 2021
Automatically generate profile picture with random first name and background color. But you can still provide pictures if you have them. As the default color, based on the name of the first letter. :fire: :fire: :fire:

FLUTTER PROFILE PICTURE Automatically generate profile picture with random first name and background color. But you can still provide pictures if you

Aditya Dharmawan Saputra 10 Dec 20, 2022
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.

flutter_statusbarcolor A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically. Getting Starte

Zero 201 Nov 10, 2022
Z time ago - A simple Flutter z time ago package used to change date to time ago for english, arabic and kurdish languages

This package is used to get time duration from now and given time for kurdish, a

Zakarya Muhammad 2 May 19, 2022
A Package to implement, change and use Themes in Flutter

Modern Themes Github: https://github.com/Jules-Media/Modern_Themes Pub.dev: https://pub.dev/packages/modern_themes About With this Plugin you can impl

Jules Media 2 Jun 22, 2022
Music-App-Flutter - This is a flutter app which has some songs displayed in the form of a list and user can play any of them by clicking on the name of the song.

music_player_app A music player app made by me in flutter About the App This is a music player which i made to play audio files which we have passed i

Harsh Kumar Khatri 3 Apr 1, 2021
My-First-Flutter-App - Startup Name Generator App with favorites option

Startup Name Generator App with 'favorites' option.. This is my first Flutter ap

REDLUNA CRYSTAL 0 Jan 21, 2022
Flutter Multi-platform allows developers to unleash their app to run on the wide variety of different platforms with little or no change.

Flutter Multi-platform sample Flutter Multi-platform allows developers to unleash their app to run on the wide variety of different platforms with lit

MindInventory 22 Dec 31, 2022
Flutter App Change Theme With Getx and Save Theme Stage with Hive

Flutter Change app Theme With GetX Flutter App Change Theme With Getx. Theme Stage saved using Hive. instead of hive you can use get-storage or shared

Azraf Al Monzim 12 Oct 22, 2022
Flutter-Theme-Changer - Change theme of your app from light to dark theme and vice versa

Flutter Theme Changer - Hard Coded This is a flutter theme changer without using

Shametha K G 4 Oct 17, 2022
Ali Türkay AVCI 1 Jan 20, 2022
Wraps Flutter shared_preferences plugin, providing a iOS Suite Name support, it's helpful for sharing data from App to Widget.

shared_preferences_ios_sn Wraps Flutter shared_preferences plugin and provides an iOS Suite Name support, it's helpful for sharing data from App to iO

null 3 Sep 14, 2022
Flutter widget to change `themeMode` during runtime and persist it across restarts.

theme_mode_handler Flutter widget to change themeMode during runtime and persist it across restarts. Motivation Flutter 1.9 introduced a new way to co

Arthur Denner 28 Oct 29, 2022
A flutter list view which can drag & move item to change order.

draggable_flutter_list A flutter list view which can drag & move item to change order. some codes come from flutter_list_drag_and_drop fix flutter_lis

刘彦博 40 Sep 22, 2022
Beautiful flutter analog clocks. Swipe to change the clock design

analog_clock_for_flutter Beautiful flutter analog clocks. Swipe to change the clock design Screenshots Usage To use plugin, just import package import

Ouzani Abd Raouf 4 Nov 3, 2021