deltachat / deltachat-android

Email-based instant messaging for Android.
GNU General Public License v3.0
1.1k stars 144 forks source link

Compile version for Android 4.1 #1212

Closed csb0730 closed 4 years ago

csb0730 commented 4 years ago

Unfortunately my device still runs on Android 4.1.2 (my only device).

Now I saw that with DC version 1.0.0 minimum requirement is Android 4.3 (!)

My question is now what general tweaks has to be done to get a version for 4.1 as before? Is it only a project setting?

r10s commented 4 years ago

My question is now what general tweaks has to be done to get a version for 4.1 as before? Is it only a project setting?

no, it is not just a project setting - if it would be doable in a simple way, we would have done that :)

we gave up support for SDKs smaller than 18 (Android 4.3 Jelly Bean) for a couple of reasons. one of them is that they are no longer supported by google, see https://github.com/deltachat/deltachat-android/pull/1115 for details about that.

r10s commented 4 years ago

hm, iirc, the "ring" crate, that was one of the reasons for sdk 18, is no longer used by one of the recent changes, so maybe we can lower the sdk to 16 again - that would again support 4.1.

but maybe only for half a year until maybe google drops support for that as well.

moreover, there may be other issues with sdk 16-17, and also this would block us using "ring" again or maybe other crates as needed. so, i would not go for lowering the sdk again. also, as supporting these old system come at very high maintenance costs.

csb0730 commented 4 years ago

@r10s It would be great to have one last version for now in current state. I mean there are many bugs fixed now and that would give many people with old phones the possibility to use 1.0.x at least. Otherwhise all these people are out from using DC. :-(

Maybe a version here in git is sufficient. What do You mean?

r10s commented 4 years ago

Maybe a version here in git is sufficient. What do You mean?

we will lose sdk 14-15 in any case, so it would be only sdk 16-17 that might work - i have not tested that. i would appreciate that, however, currently, i am not up for that. so, if someone wants to do this, i would be happy to link the apk somewhere.

adbenitez commented 4 years ago

I am also interested in the link if someone manages to compile it, there are some users with android 4.X over here, and at least having them with a 1.0.X final version would be lovely

r10s commented 4 years ago

i re-open the issue and add a help-wanted tag - maybe someone with an android 4.1 device sees this and wants to check this out. this is all i can do for now on that, as mentioned, this is out of scope of the support we can afford.

csb0730 commented 4 years ago

I got it in the past and maybe I can do it for now again. Shall I start with current sources and try to build it again? I've still old environment at my pc in the moment.

I'll do what I can. Maybe I need some hints ...

csb0730 commented 4 years ago

As I found now the latest version with 4.1 support was v0.982.0 Is it the best to use these sources (build files, etc.) and add current rust core and sources to that?

In any case I found that with ndk14b environment it's not possible to build current version because many config settings are not valid any more!

ndk-make.sh is not successful and linker settings which are described there are not valid any more.

==> any proposals are helpful

r10s commented 4 years ago

v0.982.0 already uses the rust-core.

the rust-core as such are not a problem, it's the dependencies to some libraries that required API 18 in the past, currently API 16 should be sufficient, in theory, it was never tested as we did not lower the API after we've raised it.

so i would try to change the corresponding API settings in ndk-make.sh and in the manifest (maybe also gradle and other places) and try if the thing builds.

i am willing to try this later on, however, if build does not run through, i will not investigate further. if it runs through i can add the apk here and you can see if it actually works on 4.1

csb0730 commented 4 years ago

Hi Björn, with rust, yes this should not be the problem. I got the demoapp complied. Only the full project is not working so far. When compiling the app with ndk-make.sh build stops with error "Cant find core ..." or similar.

But back to your proposal: Means that, I should install ndk21 in parallel (this means tweaks in .profile and/or .bashrc), use the current configuration and simply set API settings back to 16 ?

r10s commented 4 years ago

Means that, I should install ndk21 in parallel (this means tweaks in .profile and/or .bashrc), use the current configuration and simply set API settings back to 16 ?

this is, what i would try. if that fails, there is no "good plan" to get things working. at least for me, that would be out of scope then.
i am currently building a new android version, when this is done, i will give the lowered api a try.

r10s commented 4 years ago

okay, here is the app compiled for sdk16, compilation works without problems. https://testrun.org/deltachat-gplay-release-1.1.2-sdk16.apk

@csb0730 @all - can you please try out if it works on Android 4.1 and 4.2 (Jelly Bean) - if it does, and there are not problems on actual androids (i would not expect that), we can maybe lower the min-sdk again to 16 and gain 3% Android 4.1 users :)

csb0730 commented 4 years ago

Hi @r10s as I have only one device and I need my production version of DC for daily work, I usually compile a testing version with a different applicationIdSuffix to install it in parallel with a different account for testing! See here (excerpt from build.gradle):

buildTypes {
       debug {
           minifyEnabled true
           ...
           //applicationIdSuffix ".testing"   <== this here
           applicationIdSuffix ".beta"
           debuggable false
       }

So, to test it it would be welcome for me to have the sources of this testing version available to build such a "parallel version" in my case.

Is it possible to get the full sources for that testing apk (https://testrun.org/deltachat-gplay-release-1.1.2-sdk16.apk) somewhere? Maybe as a zip file?

r10s commented 4 years ago

@csb0730 the full sources are at https://github.com/deltachat/deltachat-android/pull/1227 - depending on your setup, you may need to adapt ~/.cargo/config, see comment in ndk-make.sh

csb0730 commented 4 years ago

... or are the sources the current one's with simply the minSdkVersion changed to 16 in build.cradle?

Wasn't there an issue in the past to keep minSdkVersion 14 to cover this? I have something in mind around that. Maybe this is gone now with current ndk 21? (I can't find it in issues any more).

EDIT: We had some overlapping in writing these comments ;-) and I found that this here: "audio message problem #220" was the reason to keep ndk14b for a long time (not sdk 14 as I wrote before).

csb0730 commented 4 years ago

Ok thanks. I'll have a look ... :-)

csb0730 commented 4 years ago

Ok, got it :-).

There are really only small tweaks in build files. Easy to merge it into current sources.

Thanks r10s :+1:

r10s commented 4 years ago

closed by #1227 - so, welcome back, android 4.1 :)

csb0730 commented 4 years ago

Got it to compile v1.1.2 now. Will start testing on Android 4.1.2 ;-)

Thanks r10s for your support :+1:

csb0730 commented 4 years ago

Standard functions are working, even audio message is working. This has been an issue in the past to keep nkd14b for a long time.

All ok so far :-)

r10s commented 4 years ago

@csb0730 thanks for continuous testing and for your reports!

csb0730 commented 4 years ago

Unfortunately image editing is not working any more. There is a toast now "Android 4.4 Kitkat is minimum requirement". As this is an often used important feature for me I'm trying to get it work again.

When I reduce ndk requirement to 16 then only a blank black window is shown but with no functionallity.

Sources I'm using for testing in the moment are v1.2.1 master branch (2020-03-20). This builds fine!

As I found there are code changes in scribble module which prevent using that image editing feature. Upgrade from android... to androidx libraries and different approach in doing this. In the past this feature worked fine so I compared my working version (v0.500.0) with current one. Then tried to copy scribble module code from 0.500 to current an rebuild ==> not working.

In a first step I tried to replace all used old imports to the ones from androidx. But this seems difficult to me because I'm not so familiar in Android programming.

Work is in progress now ... but I suspect that I need assistance to complete that job!

@r10s is there a possibility to upgrade scribble code from android to androidx libs automatically? Or any other hints?

All help is welcome!

r10s commented 4 years ago

well, there are some parts that are not working on really old android versions.

this is needed to keep things maintainable and doable. we, as the current team do not have the resources to work around that, it is just too much effort for too few results. and even if there are more resources, it would probably not make much sense as this would result in unreadable and hard to maintain code - and in potential problems with newer android versions.

csb0730 commented 4 years ago

Ok, but for my device current 1.2.1 is a step back and not fully usable for my purpose any more. To contribute to the project I need at least functionality of 0.500 and not less.

... but meanwhile I managed the build with the backport :-)

I exchanged all lib imports by androidx ones and provided missing resources.

If test is successful I'll push the sources to my repo.

r10s commented 4 years ago

ftr, 0.500 cannot be recommended at all any longer.

1.2.1 offers lots of stuff wrt reliability, stability, security - while scarifying image editing and maybe some other pro-features for really old androids. i think, this is a good compromise - esp. as some weeks ago, android 4.3 was not supported at all.

sure, this might annoy some users, however, overall, i would not say, this is a "step back" :)

csb0730 commented 4 years ago

Hi Björn, ftr I'm not using pure 0.500 (it's 0.304.x, short before reveal of 0.500 and added some fixes and enhancements).

But now I got it :+1: :-)

v1.2.1 with image edit backport from old version.

It builds AND runs as before at my Android 4.1.2 device :+1: I'm really happy now.

Thus I added some further enhancements.

I'm doing some tests now and then will push the sources to github.

csb0730 commented 4 years ago

Done, see here https://github.com/csb0730/deltachat-android

All commits from Apr 01 are relevant. I have three commits because of misunderstanding of git commands :-/

First commit describes all changes and updates. Don't know if or how I should do a PR.

r10s commented 4 years ago

so the fix is mainly this commit https://github.com/csb0730/deltachat-android/commit/b035bfdd8ac92a7d38b77d6196ffe1fbcb90d646 ? this does not look related to the android 4.1 or image-editing topic?

csb0730 commented 4 years ago

Hi, no. I need to explain a little because I added some features and did the backport of scribble module for image editing.

Backport is not in changelog (will add this too!). But especially this I did to restore the image editing function for Android 4.1 again.

b035bfd (3) is the last commit which corrects only some small bugs I detected later while testing.

0878c0a (1) describes main changes for features I added (icons, scroll-up button, debouncer, short cut badger, do not recode video when Android 4.1).

ac2a7ca (2) only adds all files which are not existing in v1.2.1 before (the unstaged files). This commit results in wrong usage of git. In principle (1) and (2) are belonging together as one commit!

But the real change for Android 4.1 I did, was the backport of scribble module to restore image editing. Therefore I did:

So far

r10s commented 4 years ago

okay, i see. so this is a fork of Delta 1.2.1 with image editing from 0.500. wrt to a pr - well, i do not think, we currently have the resources to maintain that in the future (1.2.1 is already outdated ...)

However, nice - and, of course, there may be some users who would like that (if plan to upload the apk somewhere, maybe modify name and icon to avoid confusion :)

csb0730 commented 4 years ago

Hi @r10s , if there is some need I'm able to provide a PR for current or newer version (image editing backport). I mean, the main work is done now and in principle it's only a copy of the fork's changes into current version. Why to maintain anything?

But regardless what approach now, as a first step I will upload an apk of the special 4.1 fork (see next post). Maybe others can use it if required.

But what about the other stuff which is included?

We should discuss about this.

csb0730 commented 4 years ago

New APK including short documentation can be found here: https://github.com/csb0730/deltachat-android/releases/tag/v1.2.2-testing

r10s commented 4 years ago

scrolling up is meanwhile also possible via "empty search -> up" :) see https://github.com/deltachat/deltachat-android/pull/1280

r10s commented 4 years ago

feel free to add a forum post for this btw, i think this discussion here in a closed issue is quite invisible (any other android 4.1 users please speak up if i am wrong :)

cyBerta commented 4 years ago

Hi @csb0730! Cool that you managed to hack on DC and modify it to your needs! :+1: I just wanted to mention, that updating the scribble was done in order to include new features and bug fixes for the vast majority of devices. So reverting that would not be an option. Having both codes bases next to each other and using the one or the the other depending on the OS version would result in more complexity and worse maintainability but is theoretically possible. (Personally I would prefer more hackers like you provide special forks for rare needs.)

csb0730 commented 4 years ago

Hi @cyBerta hi @r10s

my intention to make this 1.2.2 fork version (mainly the scribble backport) was, to have the possibility again to support DC. But therefore I need a version of DC which is working for me. Not all features, but the main ones I need in daily business! Image editing unfortunately was the one which forces me to go this way. I'm not confident with that approach, but it's doing the job! As I have only one device (the good old S3 mini), DC needs to run onto that. For testing and daily business. For me new features are not so important than having the old ones stable and reliable.

Another reason for doing the fork was that I was very annoyed that the small but IMHO really important feature "jump up in a chat" has been gone. It's needed to delete old msgs in a big chat. No idea when it should come back, but ok. Now it's there again (1280) The next one is the badge counter at start screen icon. Meanwhile I convinced some friends to use DC but quite all of them complained that they didn't get noticed by DC to have a new message. I get asked why that happens but I have no solution for them :-( All of them are non programmers and Whatsapp users! I mean, if You use DC as a your main and only messenger it might be ok to have only the small delta at top of screen but if DC is only one of many other apps this small badge gets lost in the shuffle of all other app badges.

So now,

I feel that this comment maybe is too long, but lets work on :-)

csb0730 commented 3 years ago

Now quite a year later, see these results of development: https://github.com/deltachat/deltachat-core-rust/issues/2208