Sunday 28 June 2020

How to change Package name in Flutter?

FOR ANDROID APP NAME

change the label name in your AndroidManifes.xml

 <application

    android:name="io.flutter.app.FlutterApplication"
android:label="TheNameOfYourApp"

FOR PACKAGE NAME

Change the package name in your AndroidManifest.xml

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="your.package.name">

Also in your build.gradle file inside app folder

 defaultConfig {

    applicationId "your.package.name"
minSdkVersion 16
targetSdkVersion 28
resConfigs "en"
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

finally change the package in your MainActivity.java 
class(if the MainActivity.java is not 
avaiable ,check the MainActivity.kt

 package your.package.name;


import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;

import androidx.annotation.NonNull;
public class MainActivity extends FlutterActivity {}

Change the directory name:

From

 android\app\src\main\java\com\example\name


To.

 android\app\src\main\java\your\package\name


IOS

in ios the package name is the bundle identifier in Info.plist

 <key>CFBundleIdentifier</key>

<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

which is found in Runner.xcodeproj/project.pbxproj

 PRODUCT_BUNDLE_IDENTIFIER = com.example.appname;



1 comment:

  1. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is wonderful blog. A great read. I'll certainly be back. imac service berlin

    ReplyDelete