How to remove default assets from ionic 2 build? - ionic-framework

I am learning Ionic 2; writing code in Visual Studio code. I created project using following command:
> ionic start --v2 MyFirstIonic blank
And then
> cd MyFirstIonic
> ionic platform add android
When I build and run, > ionic run android, ionic creates assets folder in www directory and copies font files for Ionicons, Roboto, and Noto-sans, which are added in apk during build process. I'd like to exclude Ionicons, Roboto, and Noto-Sans from final build, and use FontAwesome files instead. How will I be able to achieve this?

You need to edit your node_modules/#ionic/app-scripts/copy.config.js.
Sample file here.
Remove copyFonts entry :
copyFonts: {
src: ['{{ROOT}}/node_modules/ionicons/dist/fonts/**/*', '{{ROOT}}/node_modules/ionic-angular/fonts/**/*'],
dest: '{{WWW}}/assets/fonts'
},
from the file. This copies the ionicon fonts to your www folder.
Also remove the assets you do not need from src/assets folder.
You can edit copy.config.js file to add any other assets into the build process.
Refer answers here.

I would suggest you delete the unnecessary files from:
[project]/node_modules/ionic-angular/fonts/
(Keep the ionicons.* files.)
You'll still have to do that every time you update ionic-angular but it's easier and less error prone than keeping track of changes to the app-scripts bundle.
Additionally, comment out the roboto and noto-sans imports in:
[project]/src/theme/variables.scss
--
If you still want to update the script then the right way to do that is to copy the file locally as [project]/src/webpack.config.js and add the following entry to your package.json:
"config": {
"ionic_webpack": "./webpack.config.js"
}
--
Hope that helps!

Related

What is the standard way of renaming Flutter application? [duplicate]

Is there any way to change Package Name of Flutter project?
I want to change package name and application name in flutter project.
For Android App Name
Change the label name in your AndroidManifest.xml file:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="TheNameOfYourApp"
For Package Name
Change the package name in your AndroidManifest.xml (in 3 of them, folders: main, debug and profile, according what environment you want to deploy) file:
<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 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Finally, change the package in your MainActivity.java class (if the MainActivity.java is not available, check the MainActivity.kt)
package your.package.name;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
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
EDITED : 27-Dec-18
for package name just change in build build.gradle only
defaultConfig {
applicationId "your.package.name"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
For iOS
Change the bundle identifier from your Info.plist file inside your ios/Runner directory.
<key>CFBundleIdentifier</key>
<string>com.your.packagename</string>
UPDATE
To avoid renaming the package and bundle identifier, you can start your project using this command in your terminal:
flutter create --org com.yourdomain appname
Changing name manually doesn't seem to work, throws gradle errors, well in my case it does throw error.
So I usually create a new flutter project.
I use below mentioned command to create a new flutter app
flutter create --org com.yourdomain appname
your project will have the package name as -> com.yourdomain.appname
if you just want to keep your package name as com.appname then make some changes as below
flutter create --org com appname
to add java instead of kotlin for android add -a java
flutter create -a java --org com.yourdomain appname
EDIT
If you have already created a project you can use change_app_package_name package to change the package name.
flutter pub run change_app_package_name:main com.package.appname
For those like me that doesn't like to change specific files, I've used https://pub.dev/packages/rename.
Using this, you simply run these commands in your terminal and your app name and identifiers will be changed.pub global run
Installing: pub global activate rename
And then, Run this command inside your flutter project root.
pub global run rename --bundleId com.example.android.app --target android
Android
In Android the package name is in the AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
package="com.example.appname">
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;
Changing the name
The package name is found in more than one location, so to change the name you should search the whole project for occurrences of your old project name and change them all.
Android Studio and VS Code:
Mac: Command + Shift + F
Linux/Windows: Ctrl + Shift + F
Thanks to diegoveloper for help with iOS.
Update:
After coming back to this page a few different times, I'm thinking it's just easier and cleaner to start a new project with the right name and then copy the old files over.
This is how i renamed package for both ios and android
Go to build.gradle in app module and rename applicationId "com.company.name"
Go to Manifest.xml in app/src/main and rename package="com.company.name" and android:label="App Name"
Go to Manifest.xml in app/src/debug and rename package="com.company.name"
Go to Manifest.xml in app/src/profile and rename package="com.company.name"
Go to app/src/main/kotlin/com/something/something/MainActivity.kt and rename package="com.company.name"
Go to app/src/main/kotlin/ and rename each directory so that the structure looks like app/src/main/kotlin/com/company/name/
Go to pubspec.yaml in your project and change name: something to name: name, example :- if package name is com.abc.xyz the name: xyz
Go to each dart file in lib folder and rename the imports to the modified name.
Open XCode and open the runner file and click on Runner in project explorer.
Go to General -> double click on Bundle Identifier -> rename it to com.company.name
Go to Info.plist click on Bundle name -> rename it to your App Name.
close everything -> go to your flutter project and run this command in terminal flutter clean
Change name attribute in pubspec.yaml (line 1)
For the name of apk, change android:label in AndroidManifest.xml
As easy as possible use this change_app_package_name package first add dependencie
dev_dependencies:
change_app_package_name: lates version
and then run this command
flutter pub run change_app_package_name:main com.new.package.name
Quickest and cleanest way to change your package name!
Warning:
If you have edited the contents of the folders android/, ios/ and windows/, you need to make sure you have those changes backed up somewhere before proceeding.
1. Delete your folders at the root of your flutter project:
android/
ios/
windows/
build/
Let's say you want to rename from com.oldcompany.oldproject to com.newcompany.newproject.
2. Launch the following command from the root of your project:
flutter create --org com.newcompany --project-name newproject .
PS: To make sure everything is set up correctly, you can search for your package names in your files, by running the following commands
grep --color -r com.oldcompany.oldproject *
grep --color -r com.newcompany.newproject *
If you not started the project, this is the best possible way.
flutter create --org com.yourdomain appname
If you already created the project, install this package in your dev_dependencies and run this command.
flutter pub run change_app_package_name:main com.new.package.name
This will change all the complex stuffs of changing package name in android. And right click on the iOS folder of flutter and open with Xcode.
In Xcode > select Runner > In general tab you can change the bundle Identifier.
This is the easiest possible way if you already created a project and don't know the complexity of change the package name.
Updated You have to change the package name to your desired package name in these
five locations.
1.) src/profile/AndroidManifest.xml
2.) src/debug/AndroidManifest.xml
3.) src/main/AdroidManifest.xml
4.) app/build.gradle
build.gradle .
defaultConfig {
applicationId
}
5.) MainActivity.java or MainActivity.kt on "package"
the last step is to run flutter clean
First, run this in your terminal
dart pub global activate rename
Run this in your Flutter Project Root Directory
dart pub global run rename --bundleId com.company.appname --target android
And that's everything, now you changed your package name :)
On Visual Studio code
Edit > Replace in Files
On Android studio
1. Right click on your project > Replace in path
2. Write your old package and new package > Replace all
According to the official flutter documentation you just need to change the ApplicationId in app/build.gradle directory. Then you have to just build your apk and the package name of the manifest file will be changed according to the ApplicationId you changed in build.gradle. Because of flutter while building an apk and google play both consider ApplicationId from build.gradle. This solution worked for me.
source: Official Documentation
change in all AndroidManifest.xml files of your Flutter Project, --> package="your.name.app"
(app/src/debug/AndroidManifest.xml) and
(app/src/main/AndroidManifest.xml) and (app/src/profile/AndroidManifest.xml)
good look !!
the right to change path for default way for both Android and Ios.
for Android
open AndroidManifest.xml,
go to this path.
app/src/main/AndroidManifest.xml
select on package name, and right click,
after click on rename, rename popup(dialog) show.
enter the new package name here,
after changes name text, click on refactor button.
__________________________________________________________________________
for Ios
select ios folder from drawer, and right click on these,
select,and double click on Runner in drawer,and then select General
and then, change your Bundle Identifier(Package Name).
after changes Bundle Identifier(Package Name), Your Package Name is
changed for Ios.
To change package name in flutter , you have to do it for all platforms.
To make it easier, I suggest you to use rename package .
Just run this command inside your flutter project root.
pub global run rename --bundleId com.onat.networkApp
Here, com.onat.networkApp is your package name
To target a specific platform use the "-t" option.
e.g:
pub global run rename --bundleId com.example.android.app -t android
You can learn more about rename package here
Change App Package Name with single command by using following package. It makes the process very easy and fast.
flutter pub run change_app_package_name:main com.new.package.name
https://pub.dev/packages/change_app_package_name
Change App Package Name easily using change_app_package_name package
just add the above package in dev dependencies
dev_dependencies:
flutter_test:
sdk: flutter
change_app_package_name: ^0.1.2
and run the following command, replace "com.new.package.name" with your new package name
flutter pub run change_app_package_name:main com.new.package.name
Package Link on Pub Dev
Even if my answer wont be accepted as the correct answer, I just feel all these answers above caused me to have more problems here is how I fixed it
Get Sublime Text (crazy, right? No, just follow my steps)
Click on file and select open folder, then choose the folder of the project you are working on
Now click on Find from the Tabs, and select find in files or just do Ctrl + Shift + F (for Windows users, for mac users you already know the drill)
Now copy and paste exactly the name of the package you want to change in the Find section and paste in the replace section what you would like to replace the package name with.
Click on FIND (do not click on REPLACE just yet).
Now clicking on Find lists all available package name in your project which matches your search criteria, if you are satisfied with this then repeat from no. 3 but this time click on REPLACE.
Rebuild your project and have fun
Conclusion: a simple find and replace program is all you need to sort this problem out, and I strongly recommend Sublime Text 3 for that.
After trying all of the above. Simple work for me to rename package flutter with
Android Studio:
Step 1:
Mac: Command + Shift + R
Linux/Windows: Ctrl + Shift + R
After change to new package and press Replace All and wait Android Studio run finish.
Step 2:
Next, go to AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name">
and copy package name and do the same Step 1 to rename package in AndroidManifest and build.gradle.
Finally, change the package in your MainActivity.java class (if the MainActivity.java is not available, check the MainActivity.kt)
package your.package.name;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
Change the directory name.
For details see the following link this:
From:
android\app\src\main\java\com\example\name
To:
android\app\src\main\java\your\new_package\name
EASY way, in editor search E.g.VS CODE your.package.name E.g com.example.application through all files.,
3 AndroidManifest files(profile, debug, main)
1 build.gradle
1 java
or kt file
these will popup
Replace all these and voila. If you have already build your project, numerous files will popup in the build directory, you can ignore that files, no need to change those
As of Android Studio 4.1.3, changing package name couldn't be more easy.
If you don't use Firebase or any other external service, just change the package name in these files:
In the build.gradle (app) file
In the Manifest file (main, debug and profile)
Package import in code files (Android Studio. will handle the changes)
NOTE: Also change the directory name (under Kotlin or Java).
If you use Firebase or any other external Service, you need to change the package name there too.
I had two manifest.xml file in my app section,so I needed to change package name in both
In Android, change application id in
> build.gradle
file and iOS change
> bundle name from project settings.
If you don’t like changing files in such a way then alternative way would be to use this package.
https://pub.dev/packages/rename
rename --bundleId com.newpackage.appname
pub global run rename --appname "Your New App Name"
Using this, you simply run these 2 commands in your terminal and your app name and identifiers will be changed.pub global run
I have done global search for existing package name, and changed all fields with new package name. Then changed
app->src->main->yourOldFolderName
folder name as per new package name. After that, changed all imported package name to new package name. It was a lot of manual work but was worth it, without any issues.
Note: Watch for the blank space before package name it may give built errors
Short-cuts:
global search- ctrl+shift+f
To change package
file search- ctrl+f
To change import package name
Use this plugin (2022)
https://pub.dev/packages/change_app_package_name
Usage
flutter pub run change_app_package_name:main com.new.package.name
Old Package Name: com.example.oldname
Updating build.gradle File
Updating Main Manifest file
Updating Debug Manifest file
Updating Profile Manifest file
Project is using kotlin
Updating MainActivity.kt
Creating New Directory Structure
Deleting old directories
if you are using VS Code, you could replace all your com.example to your package name
To do so, CTRL+SHIFT+H
set the word to replace com.example
set the word replace with [your package]
then REPLACE ALL
You can follow this official documentation by Google: https://developer.android.com/studio/build/application-id.html
Application ID should be changed in Build.gradle, while package name can be changed in AndroidManifest.xml.
However one should be careful changing package name.
Also while re uploading the app, one should be careful since it matches the application ID of previously uploaded app with new upload.
I don't think it's the proper solution for the problem. But you can just create a new project with the package name you want and then copy all the source files to the new project from your existing projects.
**NOTE: You'll have to copy all the contents of pubspec too. In the case of firebase and other APIs, that solution may be a bit lengthy.

Include or Exclude node_modules with esbuild

I am using esbuild to build a vscode extension. The build gives a warning like:
✨ Done in 1.28s.
This extension consists of 7026 files, out of which 5430 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
DONE Packaged: /my-vscode/my-vscode-0.0.2.vsix (7026 files, 8.43MB)
I am not sure I node_modules need to be added to .vscodeignore ? when I tried doing it and installed the plugin, I get an error that my commands are not found ..
Any thoughts ?

How to change package name in flutter?

Is there any way to change Package Name of Flutter project?
I want to change package name and application name in flutter project.
For Android App Name
Change the label name in your AndroidManifest.xml file:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="TheNameOfYourApp"
For Package Name
Change the package name in your AndroidManifest.xml (in 3 of them, folders: main, debug and profile, according what environment you want to deploy) file:
<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 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Finally, change the package in your MainActivity.java class (if the MainActivity.java is not available, check the MainActivity.kt)
package your.package.name;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
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
EDITED : 27-Dec-18
for package name just change in build build.gradle only
defaultConfig {
applicationId "your.package.name"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
For iOS
Change the bundle identifier from your Info.plist file inside your ios/Runner directory.
<key>CFBundleIdentifier</key>
<string>com.your.packagename</string>
UPDATE
To avoid renaming the package and bundle identifier, you can start your project using this command in your terminal:
flutter create --org com.yourdomain appname
Changing name manually doesn't seem to work, throws gradle errors, well in my case it does throw error.
So I usually create a new flutter project.
I use below mentioned command to create a new flutter app
flutter create --org com.yourdomain appname
your project will have the package name as -> com.yourdomain.appname
if you just want to keep your package name as com.appname then make some changes as below
flutter create --org com appname
to add java instead of kotlin for android add -a java
flutter create -a java --org com.yourdomain appname
EDIT
If you have already created a project you can use change_app_package_name package to change the package name.
flutter pub run change_app_package_name:main com.package.appname
For those like me that doesn't like to change specific files, I've used https://pub.dev/packages/rename.
Using this, you simply run these commands in your terminal and your app name and identifiers will be changed.pub global run
Installing: pub global activate rename
And then, Run this command inside your flutter project root.
pub global run rename --bundleId com.example.android.app --target android
Android
In Android the package name is in the AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
package="com.example.appname">
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;
Changing the name
The package name is found in more than one location, so to change the name you should search the whole project for occurrences of your old project name and change them all.
Android Studio and VS Code:
Mac: Command + Shift + F
Linux/Windows: Ctrl + Shift + F
Thanks to diegoveloper for help with iOS.
Update:
After coming back to this page a few different times, I'm thinking it's just easier and cleaner to start a new project with the right name and then copy the old files over.
This is how i renamed package for both ios and android
Go to build.gradle in app module and rename applicationId "com.company.name"
Go to Manifest.xml in app/src/main and rename package="com.company.name" and android:label="App Name"
Go to Manifest.xml in app/src/debug and rename package="com.company.name"
Go to Manifest.xml in app/src/profile and rename package="com.company.name"
Go to app/src/main/kotlin/com/something/something/MainActivity.kt and rename package="com.company.name"
Go to app/src/main/kotlin/ and rename each directory so that the structure looks like app/src/main/kotlin/com/company/name/
Go to pubspec.yaml in your project and change name: something to name: name, example :- if package name is com.abc.xyz the name: xyz
Go to each dart file in lib folder and rename the imports to the modified name.
Open XCode and open the runner file and click on Runner in project explorer.
Go to General -> double click on Bundle Identifier -> rename it to com.company.name
Go to Info.plist click on Bundle name -> rename it to your App Name.
close everything -> go to your flutter project and run this command in terminal flutter clean
Change name attribute in pubspec.yaml (line 1)
For the name of apk, change android:label in AndroidManifest.xml
As easy as possible use this change_app_package_name package first add dependencie
dev_dependencies:
change_app_package_name: lates version
and then run this command
flutter pub run change_app_package_name:main com.new.package.name
Quickest and cleanest way to change your package name!
Warning:
If you have edited the contents of the folders android/, ios/ and windows/, you need to make sure you have those changes backed up somewhere before proceeding.
1. Delete your folders at the root of your flutter project:
android/
ios/
windows/
build/
Let's say you want to rename from com.oldcompany.oldproject to com.newcompany.newproject.
2. Launch the following command from the root of your project:
flutter create --org com.newcompany --project-name newproject .
PS: To make sure everything is set up correctly, you can search for your package names in your files, by running the following commands
grep --color -r com.oldcompany.oldproject *
grep --color -r com.newcompany.newproject *
If you not started the project, this is the best possible way.
flutter create --org com.yourdomain appname
If you already created the project, install this package in your dev_dependencies and run this command.
flutter pub run change_app_package_name:main com.new.package.name
This will change all the complex stuffs of changing package name in android. And right click on the iOS folder of flutter and open with Xcode.
In Xcode > select Runner > In general tab you can change the bundle Identifier.
This is the easiest possible way if you already created a project and don't know the complexity of change the package name.
Updated You have to change the package name to your desired package name in these
five locations.
1.) src/profile/AndroidManifest.xml
2.) src/debug/AndroidManifest.xml
3.) src/main/AdroidManifest.xml
4.) app/build.gradle
build.gradle .
defaultConfig {
applicationId
}
5.) MainActivity.java or MainActivity.kt on "package"
the last step is to run flutter clean
First, run this in your terminal
dart pub global activate rename
Run this in your Flutter Project Root Directory
dart pub global run rename --bundleId com.company.appname --target android
And that's everything, now you changed your package name :)
On Visual Studio code
Edit > Replace in Files
On Android studio
1. Right click on your project > Replace in path
2. Write your old package and new package > Replace all
According to the official flutter documentation you just need to change the ApplicationId in app/build.gradle directory. Then you have to just build your apk and the package name of the manifest file will be changed according to the ApplicationId you changed in build.gradle. Because of flutter while building an apk and google play both consider ApplicationId from build.gradle. This solution worked for me.
source: Official Documentation
change in all AndroidManifest.xml files of your Flutter Project, --> package="your.name.app"
(app/src/debug/AndroidManifest.xml) and
(app/src/main/AndroidManifest.xml) and (app/src/profile/AndroidManifest.xml)
good look !!
the right to change path for default way for both Android and Ios.
for Android
open AndroidManifest.xml,
go to this path.
app/src/main/AndroidManifest.xml
select on package name, and right click,
after click on rename, rename popup(dialog) show.
enter the new package name here,
after changes name text, click on refactor button.
__________________________________________________________________________
for Ios
select ios folder from drawer, and right click on these,
select,and double click on Runner in drawer,and then select General
and then, change your Bundle Identifier(Package Name).
after changes Bundle Identifier(Package Name), Your Package Name is
changed for Ios.
To change package name in flutter , you have to do it for all platforms.
To make it easier, I suggest you to use rename package .
Just run this command inside your flutter project root.
pub global run rename --bundleId com.onat.networkApp
Here, com.onat.networkApp is your package name
To target a specific platform use the "-t" option.
e.g:
pub global run rename --bundleId com.example.android.app -t android
You can learn more about rename package here
Change App Package Name with single command by using following package. It makes the process very easy and fast.
flutter pub run change_app_package_name:main com.new.package.name
https://pub.dev/packages/change_app_package_name
Change App Package Name easily using change_app_package_name package
just add the above package in dev dependencies
dev_dependencies:
flutter_test:
sdk: flutter
change_app_package_name: ^0.1.2
and run the following command, replace "com.new.package.name" with your new package name
flutter pub run change_app_package_name:main com.new.package.name
Package Link on Pub Dev
Even if my answer wont be accepted as the correct answer, I just feel all these answers above caused me to have more problems here is how I fixed it
Get Sublime Text (crazy, right? No, just follow my steps)
Click on file and select open folder, then choose the folder of the project you are working on
Now click on Find from the Tabs, and select find in files or just do Ctrl + Shift + F (for Windows users, for mac users you already know the drill)
Now copy and paste exactly the name of the package you want to change in the Find section and paste in the replace section what you would like to replace the package name with.
Click on FIND (do not click on REPLACE just yet).
Now clicking on Find lists all available package name in your project which matches your search criteria, if you are satisfied with this then repeat from no. 3 but this time click on REPLACE.
Rebuild your project and have fun
Conclusion: a simple find and replace program is all you need to sort this problem out, and I strongly recommend Sublime Text 3 for that.
After trying all of the above. Simple work for me to rename package flutter with
Android Studio:
Step 1:
Mac: Command + Shift + R
Linux/Windows: Ctrl + Shift + R
After change to new package and press Replace All and wait Android Studio run finish.
Step 2:
Next, go to AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name">
and copy package name and do the same Step 1 to rename package in AndroidManifest and build.gradle.
Finally, change the package in your MainActivity.java class (if the MainActivity.java is not available, check the MainActivity.kt)
package your.package.name;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
Change the directory name.
For details see the following link this:
From:
android\app\src\main\java\com\example\name
To:
android\app\src\main\java\your\new_package\name
EASY way, in editor search E.g.VS CODE your.package.name E.g com.example.application through all files.,
3 AndroidManifest files(profile, debug, main)
1 build.gradle
1 java
or kt file
these will popup
Replace all these and voila. If you have already build your project, numerous files will popup in the build directory, you can ignore that files, no need to change those
As of Android Studio 4.1.3, changing package name couldn't be more easy.
If you don't use Firebase or any other external service, just change the package name in these files:
In the build.gradle (app) file
In the Manifest file (main, debug and profile)
Package import in code files (Android Studio. will handle the changes)
NOTE: Also change the directory name (under Kotlin or Java).
If you use Firebase or any other external Service, you need to change the package name there too.
I had two manifest.xml file in my app section,so I needed to change package name in both
In Android, change application id in
> build.gradle
file and iOS change
> bundle name from project settings.
If you don’t like changing files in such a way then alternative way would be to use this package.
https://pub.dev/packages/rename
rename --bundleId com.newpackage.appname
pub global run rename --appname "Your New App Name"
Using this, you simply run these 2 commands in your terminal and your app name and identifiers will be changed.pub global run
I have done global search for existing package name, and changed all fields with new package name. Then changed
app->src->main->yourOldFolderName
folder name as per new package name. After that, changed all imported package name to new package name. It was a lot of manual work but was worth it, without any issues.
Note: Watch for the blank space before package name it may give built errors
Short-cuts:
global search- ctrl+shift+f
To change package
file search- ctrl+f
To change import package name
Use this plugin (2022)
https://pub.dev/packages/change_app_package_name
Usage
flutter pub run change_app_package_name:main com.new.package.name
Old Package Name: com.example.oldname
Updating build.gradle File
Updating Main Manifest file
Updating Debug Manifest file
Updating Profile Manifest file
Project is using kotlin
Updating MainActivity.kt
Creating New Directory Structure
Deleting old directories
if you are using VS Code, you could replace all your com.example to your package name
To do so, CTRL+SHIFT+H
set the word to replace com.example
set the word replace with [your package]
then REPLACE ALL
You can follow this official documentation by Google: https://developer.android.com/studio/build/application-id.html
Application ID should be changed in Build.gradle, while package name can be changed in AndroidManifest.xml.
However one should be careful changing package name.
Also while re uploading the app, one should be careful since it matches the application ID of previously uploaded app with new upload.
I don't think it's the proper solution for the problem. But you can just create a new project with the package name you want and then copy all the source files to the new project from your existing projects.
**NOTE: You'll have to copy all the contents of pubspec too. In the case of firebase and other APIs, that solution may be a bit lengthy.

Bundling looking for text.js in dist directory

Using the gulp tasks from the yeoman generated Aurelia app I'm trying to bundle a custom application. When I run gulp bundle the following error is reported.
Where can I find a log to help track down this file or the reference to this file?
Double check your config.js
I've seen this from time to time, and it's usually an issue of the config.js. You'll want to make sure:
The github, npm, or wherever your text plugin is located is above your '*' line.
The text plugin is mapped.
The plugin files are located where (1) and (2) are pointing.
So, something like this:
config.js
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*",
"*": "dist/*"
},
map: {
"text": "github:systemjs/plugin-text#0.0.4"
}
And jspm_packages/github/systemjs/plugin-text#0.0.4 exists.
If all else fails, try deleting your jspm_packages folder, and typing jspm install text.

Ionic serve ignoring gulpStartupTasks

I have this ionic.project file:
{
"name": "foobar",
"app_id": "com.foo.bar",
"gulpStartupTasks": [
"styles",
"source",
"watch"
],
"watchPatterns": [
"www/**/*",
"!www/lib/**/*"
],
"sourceModules": {
"ionic": "git://github.com/driftyco/ionic.git",
"ng-cordova": "git://github.com/driftyco/ng-cordova.git"
}
}
But the gulp tasks are not being executed, I even added some console.logs to debug but nothing happened.
Any ideas?
UPDATE:
I've detected that the gulpStartupTasks are being executed asynchronously with the Ionic initialization, so when Ionic tries to find the www folder and don't find it (because my startup tasks haven't run yet) it fails and kill the process
But if I create an empty www folder to trick Ionic it works but opens a browser with an error saying that the index.html haven't been found
However, some seconds after that I see the startup tasks being executed in my shell
And if I refresh the page it works
How can I make these startup tasks run before ionic tries to find the www folder?
According to the latest Ionic-Cli documentation, if you want any gulp tasks to run before the app is served, add a serve:before task to the gulpfile.js file in your project root. In your case this would be:
gulp.task("serve:before", [
"styles",
"source",
"watch"
]);
I figured that Ionic wasn't ignoring gulpStartupTasks as I've previously updated the question, but rather executing them asynchronously to the server initialization.
To fix that I've added a postinstall script in my package.json to do the job of creating the www folder, processing the source files and then copying them to the www folder.
That solved the problem, but I still don't understand why gulpStartupTasks execute async instead of sync, it seems to be wrong. Don't you?
So I figured this out. I'm guessing that you, like myself, are editing in a different .sass or .scss file than the one that comes with ionic skeleton apps. In this case you need to add this new path to the gulp file or livereload will pick up the changes, but not actually perform the 'sass' command on the path with your new SASS file(s).
Here's my edited paths line in gulpfile.js
var paths = {
sass: ['./scss/**/*.scss', './www/sass/**/*']
};
'./www/sass/**/*' is where I put my new SASS files that I #import in the main ionic.app.scss file.
// Include all of Ionic
#import "www/lib/ionic/scss/ionic";
#import "www/sass/test";