hawknetwork / sealnote-plus

Android app for keeping encrypted notes
Other
1 stars 0 forks source link

Update tool versions and ensure smooth build #37

Closed ajburley closed 5 years ago

ajburley commented 5 years ago

Some versions are hard-coded. Update to the latest versions of tools (Gradle, Android SDK Tools etc) and ensure (a) the project still builds, (b) it builds smoothly, in-line with current best practices. This should be done with the latest version of Android Studio.

Note that this does not include upgrading the SDK version overall - see #43 for that.

EDIT: If cardslib is not removed under this issue, we need to create another issue to remove cardslib eventually.

ajburley commented 5 years ago

After upgrading the Gradle plugin version to 3.4.2 these were the immediate actions:

ERROR: Failed to resolve: com.android.support:support-v4:25.1.1
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: Sealnote, aFileChooser

ERROR: Failed to resolve: com.android.support:support-v4:19.0.+
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: Sealnote

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: aFileChooser

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: Sealnote, aFileChooser

WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: Sealnote, aFileChooser
ajburley commented 5 years ago

Okay, this has got a lot more complicated than I first imagined.

Both cardslib and sdk-manager-plugin are no longer maintained. For now I am hoping I can still use them in the short term, as I just want to get something which builds and then move on to the long term future. The docs for sdk-manager-plugin itself are saying that it's no longer needed after Gradle plugin version 2.2.0, but cardslib 1.6.0 is using Gradle Plugin version 0.10.x. Nevertheless, using SDK Manager is going to require the "android" tool, which would require going back to an old version of the Android SDK, exactly what I'm trying to avoid in this ticket.

It seems like the options are:

  1. Completely fork cardslib and set up a new build environment with the old version of Android SDK to build it into the local repository and then use it in SealNote Plus (which can continue to use the later version of the SDK).
  2. Move away from cardslib.
  3. Upgrade cardslib to the latest Gradle plugin version as well, and remove SDK Manager.

I want to avoid option 1 for now, because this would also require everyone else to do the same thing if they wanted to build SealNote Plus from source. Option 2 is a long term goal, but will probably require massive changes to the UI, which is not very practical when (in the short term) you can't even build what you have. So I am going to try with option 3 and see how far I can get.

ajburley commented 5 years ago

I used the directory names as module names: "library" and "library-extra".

Initial sync with 3.4.2:

ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: library, library-extra

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: library-extra

WARNING: The specified Android SDK Build Tools version (19.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '19.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: library, library-extra

WARNING: The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove targetSdkVersion and sync project
Affected Modules: library, library-extra

Someone else has seemingly fixed the cardslib build issues: oplarshad/cardslib@ef39a99ef827802db488ad2203e742ca58053696

But they applied their changes on top of HEAD, whereas we are on 1.6.0. Still, their commit is useful for reference.

ajburley commented 5 years ago

After resolving the above items, it works smoothly, and behaviour seems fine on Android 7.1.1 (which was the latest tested in legacy; there are known issues with Android 8.0 which we will fix in the near future). There are still many items from oplarshad/cardslib@ef39a99ef827802db488ad2203e742ca58053696 we have not implemented; I will create another issue to see whether these are needed.