-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fixes #5208: Gradle build fails with android studio flamingo update #5220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes #5208: Gradle build fails with android studio flamingo update #5220
Conversation
app/build.gradle
Outdated
@@ -168,7 +168,7 @@ project.gradle.taskGraph.whenReady { | |||
} | |||
|
|||
android { | |||
compileSdkVersion 31 | |||
compileSdkVersion 33 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed CompileSdkVersion from 31 to 33. Fixes error as described in this stack overflow issue.
app/build.gradle
Outdated
implementation ("com.squareup.okhttp3:okhttp:$OKHTTP_VERSION"){ | ||
force = true //API 19 support | ||
implementation ("com.squareup.okhttp3:okhttp:$OKHTTP_VERSION!!"){ | ||
//force = true //API 19 support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forcing dependency versions using force = true on a first-level dependency has been deprecated.
Refer to Gradle documentation.
Also, the minSdkVersion is 29 for this project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the minSdkVersion is 29 for this project.
We've pushed it back to 21, recently. I hope that doesn't affect this change 🙂
app/build.gradle
Outdated
@@ -341,7 +340,11 @@ android { | |||
buildFeatures { | |||
viewBinding true | |||
} | |||
|
|||
namespace 'fr.free.nrw.commons' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the namespace DSL to the android {} block in the module-level build.gradle file and removed the package attribute in the manifest.
This change was made as part of preparing the app build for the Android Studio Flamingo release.
Refer to this medium article.
@@ -16,7 +16,7 @@ open class OnSwipeTouchListener(context: Context?) : View.OnTouchListener { | |||
private val SWIPE_THRESHOLD_WIDTH = (getScreenResolution(context!!)).first / 3 | |||
private val SWIPE_VELOCITY_THRESHOLD = 1000 | |||
|
|||
override fun onTouch(view: View?, motionEvent: MotionEvent?): Boolean { | |||
override fun onTouch(view: View?, motionEvent: MotionEvent): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed parameter type from motionEvent: MotionEvent? to MotionEvent.
Fixes error: Type mismatch: inferred type is MotionEvent? but MotionEvent was expected
@@ -32,7 +32,7 @@ open class OnSwipeTouchListener(context: Context?) : View.OnTouchListener { | |||
|
|||
inner class GestureListener : GestureDetector.SimpleOnGestureListener() { | |||
|
|||
override fun onDown(e: MotionEvent?): Boolean { | |||
override fun onDown(e: MotionEvent): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed parameter type from e: MotionEvent? to MotionEvent.
Fixes error: 'onDown' overrides nothing
build.gradle
Outdated
gradlePluginPortal() // potential jcenter() replacement | ||
maven { url "https://jitpack.io" } | ||
maven { url "https://maven.google.com" } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced deprecated jcenter() convenience method with gradlePluginPortal() as JCenter was shutdown.
Gradle Plugin Portal was added as the JCenter dependency CircleProgressBar 1.1.1 was not available on Maven Central.
Refer to this stack overflow issue and this github issue.
gradle.properties
Outdated
@@ -14,7 +14,6 @@ | |||
# org.gradle.parallel=true | |||
#Thu Mar 01 15:28:48 IST 2018 | |||
org.gradle.jvmargs=-Xmx1536M | |||
android.enableBuildCache=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed android.enableBuildCache = true
Gradle build cache has superseded Android-specific build caches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gradle build cache has superseded Android-specific build caches.
Do we not need to add org.gradle.caching=true
in our gradle.properties to enable Gradle build cache ? 🤔
gradle.properties
Outdated
android.jetifier.ignorelist=bcprov-jdk15on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed android.jetifier.blacklist to android.jetifier.ignorelist.
Refer to this GitHub comment for more detail.
data-client/build.gradle
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed code for publishing library that caused a few errors. Library publishing code is unnecessary as the library is discontinued and contained within the main project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app is building and running fine with this PR merged.
I will test a bit more and merge if @sivaraam and @RitikaPahwa4444 are OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this up and making the app works on newer Android Studio versions!
For the note, the version 8 of Android Gradle plugin seems to bump the JDK requirement to 17. Mentioning it here just for reference. In case anyone is stuck with Java 11 or so, they could bump the Gradle plugin down to 7.3.1. The app seems to build fine with that too. Also that Gradle plugin version enables the building the app on Android Studio Dolphin and also likely on the Electric Eel version.
build.gradle
Outdated
mavenCentral() | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:4.0.1' | ||
classpath 'com.android.tools.build:gradle:8.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like 8.0.2 is already out. Could you kindly bump this up to 8.0.2 ?
It also seems like the GitHub workflow would need to be tweaked a bit to start using JDK 17 due to the changes in this MR. Could you kindly adjust that too @siva-subramaniam-v ? |
@sivaraam I tried making the CI work, but it doesn't seem to be working. I don't have much experience working with CI. Please assign it to someone with prior experience. |
I've tried putting in a change which should hopefully fix the pipeline. Let's see 🤞🏼 |
:'-( |
If you update roboelectric to 4.10.3, the number of failed tests falls from all to only 5. :-) |
hi @siva-subramaniam-v can you please push this fix, it would help a lot
|
Now would be a great time to merge this. |
This is as per the observation of Nicolas Raoul in the MR. He mentions this brings down test failures to just 5. Ref: #5220 (comment)
I successfully uploaded a picture using prodRelease of this branch: |
The next task is to fix the unit tests, they all fail with this stacktrace:
Updating How about releasing a beta right now even though the unit tests fail? By doing so, we give more time to testers while we fix the unit tests (thus allowing us to shorten a bit the final beta test phase). |
Ok Nicolas. Let us keep the changes of this MR in a separate release branch and release the beta from there. We could merge to |
Sounds good, thanks! :-) |
Thanks a lot for contributing this change @siva-subramaniam-v ! It helped much for the release of the app 🙂 For the note, we're looking to address the unit test failures as a separate issue (#5339) |
Fixes #5208
What changes did you make and why?
Tested betaDebug on
Individual comments have been added to specific changes. Changes that do not contain individual comments are either self-explanatory or made by the AGP upgrade assistant.
Note: As part of this upgrade a change was required in translatewiki which has been merged.