onatcipli / rename

The Rename CLI Tool is a utility designed to modify your Flutter project's AppName and BundleId across various platforms, such as iOS, Android, Macos, Linux, Windows and Web
https://pub.dev/packages/rename
MIT License
164 stars 39 forks source link

MainActivity.kt #28

Open Achudh opened 2 years ago

Achudh commented 2 years ago
package com.example.app

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

Need to change the package name in MainActivity.kt also.

I faced this issue when signing and building the app

onatcipli commented 2 years ago

I think this is not causing issue in my cases but It could be good to change also this one, if we change this one we also need to edit the folder names on android side since the package name will change

richardjharris commented 2 years ago

This caused an issue for me, until I renamed the class name in MainActivity.kt:

E/AndroidRuntime(18457): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{io.github.richardjharris.JapaneseYearCalculator/io.github.richardjharris.JapaneseYearCalculator.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "io.github.richardjharris.JapaneseYearCalculator.MainActivity" on path: DexPathList[[zip file "/data/app/io.github.richardjharris.JapaneseYearCalculator-4bLXRdubbkTCHzWsETpAfQ==/base.apk"],nativeLibraryDirectories=[/data/app/io.github.richardjharris.JapaneseYearCalculator-4bLXRdubbkTCHzWsETpAfQ==/lib/arm64, /data/app/io.github.richardjharris.JapaneseYearCalculator-4bLXRdubbkTCHzWsETpAfQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
kyeshmz commented 11 months ago

This was the same for me, apparently it must be the same as the namespace under androidmanifestxml

thaiquoctoanvn commented 11 months ago

I come up with a work around for new reader. Just add this line package="${your_namespace}" to your manifest.xml, this issue will be resolved. For instance I have my namespace like in the attached image below

image

then my manifest.xml would be like this

image

If your project has already had that line, just make sure it is equal to the namespace of your project folder structure. Hope this work around help!