I have created an application using Flutter, and it runs correctly. The problem occurred when I tried to upload it to the Play Store. They asked me to update the
namespace com.example.hydraulic_employee
and the
applicationId com.example.hydraulic_employee
because I cannot use the word ‘example.’ I made the changes in the build.gradle and google-services.json files, but then I received this error:
Launching libmain.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'... 54.8s
√ Built buildappoutputsflutter-apkapp-debug.apk.
Installing buildappoutputsflutter-apkapp-debug.apk... 7.2s
E/AndroidRuntime(15400): FATAL EXCEPTION: main
E/AndroidRuntime(15400): Process: com.simbrainsolutions.hydraulic_employee, PID: 15400
E/AndroidRuntime(15400): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.simbrainsolutions.hydraulic_employee/com.simbrainsolutions.hydraulic_employee.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.simbrainsolutions.hydraulic_employee.MainActivity" on path: DexPathList[[zip file "/data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/lib/x86_64, /data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(15400): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551)
E/AndroidRuntime(15400): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
E/AndroidRuntime(15400): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
E/AndroidRuntime(15400): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(15400): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(15400): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
E/AndroidRuntime(15400): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15400): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(15400): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(15400): at android.app.ActivityThread.main(ActivityThread.java:7872)
E/AndroidRuntime(15400): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15400): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(15400): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(15400): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.simbrainsolutions.hydraulic_employee.MainActivity" on path: DexPathList[[zip file "/data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/lib/x86_64, /data/app/~~sq5QywKCAXbNrdsSe4bbbw==/com.simbrainsolutions.hydraulic_employee-XUEIJt1wNJ6QQDBmEYwMxQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(15400): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
E/AndroidRuntime(15400): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(15400): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(15400): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
E/AndroidRuntime(15400): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
E/AndroidRuntime(15400): at android.app.Instrumentation.newActivity(Instrumentation.java:1339)
E/AndroidRuntime(15400): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538)
E/AndroidRuntime(15400): ... 12 more
I updated the word example
by simbrainsolutions
.
this is the build.gradle file:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace "com.simbrainsolutions.hydraulic_employee"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.simbrainsolutions.hydraulic_employee"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
// buildTypes {
// release {
// // TODO: Add your own signing config for the release build.
// // Signing with the debug keys for now, so `flutter run --release` works.
// signingConfig signingConfigs.debug
// }
// }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics'
}
and this is the google-services.json:
{
"project_info": {
"project_number": "xxx",
"project_id": "hydraulic-748ae",
"storage_bucket": "hydraulic-748ae.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:111178692999:android:3dc290cdf5ee57775c0e02",
"android_client_info": {
"package_name": "com.simbrainsolutions.hydraulic_employee"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "xxx"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}```
how can I fix the error ?
*I am new to this kind of work 'hosting'*
I tried searching extensively on Google and Stack Overflow, but I couldn't find the answer.