owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.85k stars 3.06k forks source link

[TECHNICAL] Update Android Gradle Plugin version #4507

Closed JuancaG05 closed 2 weeks ago

JuancaG05 commented 2 weeks ago

Related Issues

App: https://github.com/owncloud/android/issues/4478


QA

https://github.com/owncloud/android/pull/4507#issuecomment-2454737622

jesmrec commented 2 weeks ago

Some basic checks here, since this is nothing that needs real QA

jesmrec commented 2 weeks ago

(1) [FIXED]

Using Android Studio Ladybug to generate a signed APK:

Lint is returning errors that don't allow to build:

Lint found fatal errors while assembling a release target.

Fix the issues identified by lint, or create a baseline to see only new errors.
To create a baseline, run `gradlew updateLintBaseline` after adding the following to the module's build.gradle file:

android {
    lint {
        baseline = file("lint-baseline.xml")
    }
}

For more details, see https://developer.android.com/studio/write/lint#snapshot

owncloudApp/src/main/java/com/owncloud/android/workers/DownloadFileWorker.kt:308: Error: Missing PendingIntent mutability flag [UnspecifiedImmutableFlag]
            PendingIntent.FLAG_ONE_SHOT
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
owncloudApp/src/main/java/com/owncloud/android/workers/DownloadFileWorker.kt:329: Error: Missing PendingIntent mutability flag [UnspecifiedImmutableFlag]
            0
            ~

   Explanation for issues of type "UnspecifiedImmutableFlag":
   Apps targeting Android 12 and higher must specify either FLAG_IMMUTABLE or
   FLAG_MUTABLE when constructing a PendingIntent.

   FLAG_IMMUTABLE is available since target SDK 23, and is almost always the
   best choice. See
   https://developer.android.com/guide/components/intents-filters#CreateImmuta
   blePendingIntents for a list of common exceptions to this rule.

   https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
   https://goo.gle/UnspecifiedImmutableFlag

2 errors, 0 warnings

the problem seems to be more related with the android and SDK versions than the gradle one.. but v4.4.1 was correctly built with the same method.

Debug builds (play button) work fine

DeepDiver1975 commented 2 weeks ago

so apk build is not part of ci ... otherwise this would have been detected by ci - or am I missing anything? THX

jesmrec commented 2 weeks ago

so apk build is not part of ci ... otherwise this would have been detected by ci - or am I missing anything? THX

ci builds apk with testing purposes (debug mode). The error happened with signed apk (release mode). Release mode is just for releases, for that reason that problem was not detected for the testing jobs.

DeepDiver1975 commented 2 weeks ago

Is the difference signed vs not signed or debug vs release?

jesmrec commented 2 weeks ago

the difference in that case is signed vs not signed. It's posible to build release unsigned artifacts

JuancaG05 commented 2 weeks ago

(1) should be fixed now @jesmrec

jesmrec commented 2 weeks ago

(1) is fixed

jesmrec commented 2 weeks ago

(2)

The branding build system seems to need kind of update. It fails with the following trace:

* What went wrong:
A problem occurred evaluating project ':owncloudApp'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
      Your current JDK is located in /usr/lib/jvm/java-11-openjdk-amd64
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

we'd need someone with access to the machine to update Java version to 17. Otherwise, it will not be posible to build branded artifacts anymore. Who is in charge of this, @DeepDiver1975 ?

jesmrec commented 2 weeks ago

(2) will be fixed in the time till next release is done. Without a fix, the branding system will not work anymore. But, the app will go on with the new build setup.

Let's move