Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Lint issues on building for release #1653

Closed
Ian2012 opened this issue Apr 7, 2022 · 4 comments
Closed

Lint issues on building for release #1653

Ian2012 opened this issue Apr 7, 2022 · 4 comments

Comments

@Ian2012
Copy link
Contributor

Ian2012 commented Apr 7, 2022

When I run ./gradlew assembleProdRelease I get the following errors:

Task :OpenEdXMobile:lintVitalProdRelease FAILED
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:113: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_errorMessage.value = null
~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:122: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_courseDates.postValue(result.data)
~~~~~~~~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:146: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_errorMessage.value = null
~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:153: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_bannerInfo.postValue(result.data)
~~~~~~~~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:176: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_errorMessage.value = null
~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/CourseDateViewModel.kt:185: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_resetCourseDates.postValue(result.data)
~~~~~~~~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/InAppPurchasesViewModel.kt:79: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_checkoutResponse.value = result.data
~~~~~~~~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/InAppPurchasesViewModel.kt:101: Error: Expected non-nullable value [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_executeOrderResponse.value = result.data
~~~~~~~~~~~
/home/cristhian_g/eduNEXT/eduNEXT-code/edx-app-android/OpenEdXMobile/src/main/java/org/edx/mobile/viewModel/InAppPurchasesViewModel.kt:133: Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.3.0]
_errorMessage.value = null

The last commit I'm using is this

@mini-school
Copy link

Hi @Ian2012

I think you are on a master branch.
I tried that too for a reason it uses AGP 7.0.2 and hilt dependencies.

And I faced same issue while trying to build prod release.

I assume what's happening here is we are taking a big leap in this app and this might have caused due to upgrade in kotlin so what i did is i added null safe asserted on all of this declaration. How do you do that? Go to the precise location mentioned in log and add !! as below

_errorMessage.value = null!! Or _courseDates.postValue(result.data!!) instead _errorMessage.value = null or _courseDates.postValue(result.data).

I am assuming this is safe for now because if you look at the code it checks if(x) = !null

However the biggest challenge i find with this master branch is it takes to long to build the project. Shouldn't we be considering to improve these challanges? Like for eg. The build transforms classes with newrelic as well as firebase performance plugin.

Anyways I hope it helps or may be the another way to do it is use version 3.1.0 and make few changes that you need to as the versions are tested and trusted and that's what is being used by the edx.org's official application.

@Ian2012
Copy link
Contributor Author

Ian2012 commented Apr 13, 2022

@mini-school Thanks for your comments. I tried to change the version but unfortunately the same error appear and the version was the same.

For me it works if I use the menu Build > Build variants > Bundle (something like that). It works for every variant (prodDebugable, prodRelease, ...)

I also added a null checking on every part the error appear, but then the command show the message "Build successfully" but no file was generated.

I really think I was doing something wrong.

And yes, I was using the master branch. Btw, can we work on improve the documentation to build the Android app?

I'm working on a general guide so anyone can follow it. The objective is to avoid common or simple errors to new people. Any comments or guide you already have would be helpful.

Thanks in advance

@mini-school
Copy link

Where are you changing version?

I would say download a tag/release 3.1.0 from the repository. Use this link https://github.com/openedx/edx-app-android/releases/tag/release%2F3.1.0

Make the changes needed and you will be able to build without a problem😊

@HamzaIsrar12
Copy link
Contributor

The issue is resolved as part of the Release 3.1.4 (latest). ✨

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants