I have been trying to build an apk using the command "flutter build apk" and the apk is building perfectly fine and I am also able to run the same on my emulator. But for some weird reason when testing on a physical device I get the following error stating that "App not installed. Package appears to be invalid.". Any sort of help regarding this issue will be highly appreciated. Thanks in advance.
100% I have faced the same problem
Check or Configure agin your android/app/build.gradle
Find the Configure signing in gradle:
follow the step agin:
Or Go to your project location:
[project]/android/app/build.gradle
- Find the defaultConfig section
- Paste this code below
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
This may be due to conflicts with packages already installed on your device. This can happen when trying to install an app with the same package name as an already installed app. Please remove the problematic app and reinstall the desired app using the new APK file to fix the issue
if you just need to install the app on mobile device for testing purposes, Then create APK file using debug option flutter build apk --debug
, this will resolve the signing issue which required for prod/release version.
You can trace the log by installing the app from your shell on your PC to get the reason for this error (may its not related to signing issue):
make sure you are in flutter-apk folder and run this command on shell:
For Debug version:
$ adb install app-debug.apk
For release/Prod:
$ adb install app-release.apk
Try to do the following steps :
- flutter clean 2.flutter pub get
- flutter run
after flutter run, tried to install app-debug.apk
, hopefully it will work for you
© 2022 - 2024 — McMap. All rights reserved.
adb install <apkfilename>
. Then you will get an error message why install fails.. – Absorber