I have an app on Google Play Store. I rewrote that app on Flutter but not published yet. I don't want users to lose their data on update. To solve this I want to write a conversion system but I need to be able to reach old database when Flutter app launches.
Android system doesn't allow two different app with same package name installed. When I try to install Flutter app on a device that has Native app, Visual Studio debugger gives [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
error. It uninstalls Native app and installs Flutter app so I won't be able to reach Native app's sqlite database.
Also the reason why I use the Google Play version is I lost my old project's latest update files. There is no fraud no worries :)
After steps I did above, first build stuck at Running Gradle task 'assembleDebug'...
. Output stays like this (I waited several times, maximum for 30 mins):
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
If I clean project, it builds in 30 seconds but uninstalls Native app with this output:
Running "flutter pub get" in projectname_2...
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /Users/xxxxxx/projectname/build/app/outputs/flutter-apk/app.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package ataberkw.projectname signatures do not match previously installed version; ignoring!]
Uninstalling old version...
W/FlutterActivityAndFragmentDelegate(11073): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Connecting to VM Service at ws://127.0.0.1:58745/lUE5l2_VlN4=/ws
I realized that Google Play has it's own signature system additional to your keystore signing. Things may not exactly what I said but consequently apks Google Play and apks signed with your keystore doesn't have the same certificate. After this realization I came up with a solution.
adb adb shell pm path ataberkw.packagename
to get path of base.apk../adb pull base-apk-path destination-path
to get base apkbase.apk
to base.zip
and open it.META-INF
folder inside base.zip
and rename it to base.apk
back. Now you have unsigned apk.