New apk cannot be installed to replace current version due "Conflicting app signatures"

406 views
Skip to first unread message

Barbarur

unread,
Aug 15, 2022, 4:05:03 AM8/15/22
to Kivy users support
Hello everyone,

I recently just started using Buildozer to create apk of the apps I'm working on.

I created the first apk, I copied on my Android mobile and installed it directly from there. It worked fine, with the normal bugs on my code, but creating the apk and installation went smooth.

After testing, I fixed some bugs, create a new apk, copy to my mobile and try to install again.

This time I got an error, the app couldn't be installed.
Reason: Conflicting app signatures.
Suggestion: Uninstall the current version of this app and install the app again.

If I uninstall the app and install the new version, things go well. But I don't know how to avoid the error message.
I used exactly the same specifications for Buildozer, literally copy/paste. I only changed the version number.

Any suggestions/ideas on how to avoid this error?

Thanks in advance.

Insllation error.jpg



Andreas Ecker

unread,
Aug 15, 2022, 8:13:26 AM8/15/22
to kivy-...@googlegroups.com
Hi @Barbarur,

to install a new build on your Android mobile you always have to change/increase the version number of your app (specified in buildozer.spec)

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/f5971eb5-ea79-4f41-b662-af749a04f6f6n%40googlegroups.com.

Robert

unread,
Aug 15, 2022, 12:49:59 PM8/15/22
to Kivy users support
Very strange, a Buildozer 'debug' apk is not signed.

If you are building a 'release' apk you need to use the same signatures each time.

Tomek CEDRO

unread,
Aug 15, 2022, 3:23:46 PM8/15/22
to kivy-...@googlegroups.com
Maybe just uninstall current app on the phone / emulator and install again?
Note: Uninstall will remove all application data!
> --
> You received this message because you are subscribed to the Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/4b735ed6-56e9-4512-bade-3a2038cd4574n%40googlegroups.com.



--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Barbarur

unread,
Aug 15, 2022, 10:48:37 PM8/15/22
to Kivy users support
Hi Everyone

I'm adding below another picture, it shows I changed the version to 0.1 to 1.1, and it was recognized correctly.

On the buildozer.specs file I wrote:
- OLD version: 0.1.
- NEW version 1.1

I literally reused the buildozer.specs file to build the new apk. Just changing the version number.

I uninstalled the app and installed the new one. Yes, it worked. But I'm trying to understand how to avoid this issue in the future.


Pic.jpg

Robert

unread,
Aug 15, 2022, 10:50:33 PM8/15/22
to Kivy users support
Are you building a release apk or a debug apk?

Robert

unread,
Aug 15, 2022, 10:54:48 PM8/15/22
to Kivy users support
Also what is the device and Android version?

Robert

unread,
Aug 15, 2022, 11:23:41 PM8/15/22
to Kivy users support
It is extremely unlikely this is anything to do with the app version in buildozer.spec

If you are building a release apk:
the app is not being signed correctly, see link below

If you are building a debug apk:

It is more likely you are the first person to run in to this potential issue https://github.com/kivy/python-for-android/issues/2616   (congratulations?!)

For us, the question us why, hence my questions above (that is device name and manufacturer, and Android version).

Without those answers I will guess, but it is just a guess:

For you the workaround is probably to explicitly sign the app.
This is what users have to do to get apps into the store.
I don't know it this will work with a debug build, so it is possible you will have to do a release build.

Tomek CEDRO

unread,
Aug 15, 2022, 11:29:07 PM8/15/22
to kivy-...@googlegroups.com
On Tue, Aug 16, 2022 at 4:48 AM Barbarur wrote:
> I'm adding below another picture, it shows I changed the version to 0.1 to 1.1, and it was recognized correctly.

You have two version variables that describe your mobile application:
1. Application Version (i.e. 1.0) that is for the user to know.
2. Numeric Version (kind of build number) that is for the Android (and
Store) to know. This version needs to be incremental with each
production release.

You can control both version numbers in buildozer.spec:
1. version=0.1.
2. android.numeric_version = 1

The second is usually commented out so buildozer will auto increase
the number on each build. That does not matter when you do a Debug
build. This matters when you do a Store Release build and that should
be incremented by one on each store publish.

# (int) overrides automatic versionCode computation (used in build.gradle)
# this is not the same as app version and should only be edited if you
know what you're doing
# android.numeric_version = 1


> I uninstalled the app and installed the new one. Yes, it worked. But I'm trying to understand how to avoid this issue in the future.

You had that application already installed on a mobile device. It will
prevent you from installing "the same application" but different build
information. As suggested you should uninstall first the application
and then install again.

Did you play with android.numeric_version in buildozer.spec?

Did you build on a different machine so signatures could be different?

Moqing Yu

unread,
Aug 16, 2022, 8:36:49 AM8/16/22
to kivy-...@googlegroups.com
I met this issues before, I used a new key to sign the new version, so the release version of the app can not install

So I keep using the same sign key for the same app, and solve my problem.

<Insllation error.jpg>




--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

Barbarur

unread,
Aug 16, 2022, 2:21:24 PM8/16/22
to Kivy users support
Hi Everyone,

The issue reproduce in 2 different devices:
Device#1: Xiaomi Mi 6 running MIUI 11 based on Android 9
Device #2: One Plus 6 running OxygenOS 11 based on Android 11

I use Google Colab for running all the steps on building a debug apk. I built each apk at a different time so the runtime/environment is also different.

I didn't use the 'android.numeric_version'. But based on the comment above I gave it a try a did the test below:

Rebuilt the OLD version as:
version=1.0
android.numeric_version = 1

Rebuilt the NEW version as:
version=1.1
android.numeric_version = 2

Unfortunately the issue persist the same.

It all seems there is not other way but to sign in the app. Which is a new topic for me. I read the document Creating a Release APK, but it's still not so clear. I need for to finish with the Android Sign your app documentation, and hopefully I'll get my head around how to make and use the sign/key.

Btw, is there any documentation covering Buildozer commands and .spec file in more detail than buildozer.readthedocs? This seems a bit more like a summary than a detail documentation.

Tomek CEDRO

unread,
Aug 16, 2022, 2:42:43 PM8/16/22
to kivy-...@googlegroups.com
On Tue, Aug 16, 2022 at 8:21 PM Barbarur wrote:
> Hi Everyone,
>
> The issue reproduce in 2 different devices:
> Device#1: Xiaomi Mi 6 running MIUI 11 based on Android 9
> Device #2: One Plus 6 running OxygenOS 11 based on Android 11
>
> I use Google Colab for running all the steps on building a debug apk. I built each apk at a different time so the runtime/environment is also different.

What is Google Colab? Can you try step-by-step on your local machine?
Do you use virtualenv? Do you run as root? What is your exact
buildozer invocation command? What is the exact version of the
buildozer that you use?

Do you run `buildozer android debug deploy run` inside properly set
virtualenv as standard user?

Do you want to build a debug app or release signed app? If debug then
no sign is required I guess? If release then you can sign the app
inside the Play Store :-)

> I didn't use the 'android.numeric_version'. But based on the comment above I gave it a try a did the test below:
>
> Rebuilt the OLD version as:
> version=1.0
> android.numeric_version = 1
>
> Rebuilt the NEW version as:
> version=1.1
> android.numeric_version = 2
>
> Unfortunately the issue persist the same.

Okay we will find the problem, then if that is the problem with
buildozer we would have a fix :-)


> It all seems there is not other way but to sign in the app. Which is a new topic for me. I read the document Creating a Release APK, but it's still not so clear. I need for to finish with the Android Sign your app documentation, and hopefully I'll get my head around how to make and use the sign/key.
>
> Btw, is there any documentation covering Buildozer commands and .spec file in more detail than buildozer.readthedocs? This seems a bit more like a summary than a detail documentation.

I cannot see anything specific to Android app signing in the default
buildozer.spec, only for the iOS, sorry :-(

When I want to see details of some application or how things work I
would take look at the source code directly :-) I found out how
parsing version from an external file works that way :-)

Have you reported that Issue on Buildozer github?

Robert

unread,
Aug 16, 2022, 4:42:03 PM8/16/22
to Kivy users support
> Device#1: Xiaomi Mi 6 running MIUI 11 based on Android 9
> Device #2: One Plus 6 running OxygenOS 11 based on Android 11

"based on" that is the issue.

Buildozer (p4a really) debug builds depend on some Android code that signs a debug app.
On standard Android the key for that sign is stable except on major tool version bumps.

It looks like the default key generation is more volatile on these OS.
I will update the existing issue, and notify the devs.

The workaround (I assume) is to build a signed release apk. 

Barbarur

unread,
Aug 17, 2022, 12:34:54 PM8/17/22
to Kivy users support
Hi Everyone,
              

Colab is a Temporal Online Virtual Machine, mainly focus to execute Python code. It is provided by Google and each time it creates a new virtual machine that last up to 12h maximum, or until you close it. Then the environment gets deleted. So each time it is a different environment/machine.

Here more info on Colab: https://research.google.com/colaboratory/faq.html#whats-colaboratory


I believe in Colab, everything run as root, though I didn’t see this clarifications on Colab documentation.

Because each time it is a new machine, I have to install install Buildozer and all dependencies, so I should be using always the latest version.


For building the apk I run “buildozer -v android debug”, I only want to build a debug app at the moment.


Originally, the first time I built the apk for both versions, I did on different times, so I was also using different environments.


The second test I did, it was to test using “android.numeric_version”. I closed Colab (the environment) and reopen a new one between each build, to ensure they were different. I wanted using “android.numeric_version” to be the only difference between the first and second test.


Today I did a third test. I build the apk for both versions using “android.numeric_version”, but I didn’t close the environment. I used the same environment to build both apk.

This time there was no issue. I installed version 1.0 and then I installed version 1.1, The app updated correctly, without need to uninstall the previous version


I have pending to do a fourth test, were I build both apk on the same environment, but without using “android.numeric_version”. I will let you know tomorrow


I work on Windows, so I’ll try tomorrow also to use VirtualBox and create an Ubuntu VM to also test there.

Robert

unread,
Aug 17, 2022, 1:05:45 PM8/17/22
to Kivy users support
Thanks that is interesting.

I interpret this as the issue is related to a new build environment or a new install in the build environment (of Buildozer and dependencies).
I'll be interested to see what you discover.

There is some related information, it is known that a major update to p4a will cause this issue (for the first build of a project). Which sounds related.
I use WSL and have not noticed any other cases, which does not mean they don't exist.

Tomek CEDRO

unread,
Aug 17, 2022, 3:58:14 PM8/17/22
to kivy-...@googlegroups.com
On Wed, Aug 17, 2022 at 6:35 PM Barbarur wrote:
> Colab is a Temporal Online Virtual Machine, mainly focus to execute Python code. It is provided by Google and each time it creates a new virtual machine that last up to 12h maximum, or until you close it. Then the environment gets deleted. So each time it is a different environment/machine.
> (..)
> Because each time it is a new machine, I have to install install Buildozer and all dependencies, so I should be using always the latest version.
> (..)
> For building the apk I run “buildozer -v android debug”, I only want to build a debug app at the moment.
> (..)
> Today I did a third test. I build the apk for both versions using “android.numeric_version”, but I didn’t close the environment. I used the same environment to build both apk.
>
> This time there was no issue. I installed version 1.0 and then I installed version 1.1, The app updated correctly, without need to uninstall the previous version

Thanks for the hint on what Colab is.. this may be the source of your
problem.. as whole environment is re-created from scratch then also
temporary signing keys may differ, but when you build on the same
environment one time after another there is no problem.

Please try building on your local machine there should be no problem
that you describe with the signing keys because you will then use the
same setup for following builds.

For working in temporary environments like Colab (or any sort of CI),
Buildozer should be getting a signing process details, like it is done
for iOS. I am not sure if that feature is already here.

Also note that providing signature keys remotely to an untrusted host
is a serious security concern. You should never sign a release like
this as they keys may leak out and someone may take over your
application, platform, and user base! However temporary keys may be
provided over sshfs, or even hardcoded into the buildozer.spec, that
should solve the problem.

Please report that Issue on a Buildozer repo. This may be useful
feature to add. Maybe it is already here. I am not that familiar with
Buildozer yet sorry :-)
Reply all
Reply to author
Forward
0 new messages