Skip to content
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

QA: Configure R8 for release build #1069

Merged
merged 2 commits into from
May 15, 2021
Merged

Conversation

epicadk
Copy link
Member

@epicadk epicadk commented Jan 29, 2021

Description

Configure R8 and proguard rules for the release build. Apk size has reduced to 2.44mb from the existing 4.01mb.

compare

Fixes #1063

Type of Change:

Delete irrelevant options.

  • Code
  • Quality Assurance

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

Ran the release build locally.

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas

Code/Quality Assurance Only

  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Copy link
Member

@vj-codes vj-codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epicadk the size is almost half , yayay 🚀 I've got a small change-
The org name is wrong under model classes it should be anitab instead of systers, an issue #741 is there to change the name as well.
Can you update that here first and probably this will wait until the PR for #741 is done , what say?
Also add a screenshot showing the changed size please .

@vj-codes vj-codes added the Status: Changes Requested Changes are required to be done by the PR author. label Jan 31, 2021
@epicadk
Copy link
Member Author

epicadk commented Feb 1, 2021

@vj-codes added the screenshot. I don't see why we have to wait ? Since the issue is not assigned yet we can ask someone the contributor to make changes to the proguard rules as well.

@vj-codes
Copy link
Member

vj-codes commented Feb 1, 2021

@epicadk yess I've already posted on zulip, but the PRs linked with that issue are made against the community guidelines by contributors who were not assigned to it so they can't be reopened .
Someone will surely claim it soon:)

@epicadk
Copy link
Member Author

epicadk commented Feb 1, 2021

@vj-codes can the tag be updated now or do I still need to make changes?

@vj-codes
Copy link
Member

@epicadk the apk size by this PR is 7.24 but earlier it was 8.8
Although it's decreased the size isn't 2.44 , any idea why?
And why did you not shrink for app-debug.apk because that's the apk we primarily downloaded for testing ?

@epicadk
Copy link
Member Author

epicadk commented Feb 10, 2021

@epicadk the apk size by this PR is 7.24 but earlier it was 8.8
Although it's decreased the size isn't 2.44 , any idea why?
And why did you not shrink for app-debug.apk because that's the apk we primarily downloaded for testing ?

Because obfuscation makes it harder to debug so shrinking is generally only performed on the release apk.

Are you talking about after installation size? Because I've added the screenshot that compares the two apks using android studios inbuilt apk analyser.

@epicadk
Copy link
Member Author

epicadk commented Feb 17, 2021

@epicadk the apk size by this PR is 7.24 but earlier it was 8.8
Although it's decreased the size isn't 2.44 , any idea why?
And why did you not shrink for app-debug.apk because that's the apk we primarily downloaded for testing ?

Because obfuscation makes it harder to debug so shrinking is generally only performed on the release apk.

Are you talking about after installation size? Because I've added the screenshot that compares the two apks using android studios inbuilt apk analyser.

@vj-codes can you confirm this ?

@vj-codes
Copy link
Member

vj-codes commented Mar 2, 2021

@epicadk yes I was speaking about installation size

@vj-codes vj-codes added Status: Needs Review PR needs an additional review or a maintainer's review. and removed Status: Changes Requested Changes are required to be done by the PR author. labels Mar 2, 2021
@epicadk epicadk requested a review from annabauza March 4, 2021 13:11
Copy link
Contributor

@annabauza annabauza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@epicadk epicadk requested a review from vj-codes March 4, 2021 15:16
Copy link
Member

@vj-codes vj-codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@vj-codes vj-codes requested review from isabelcosta and rpattath March 5, 2021 09:08
@epicadk epicadk added Status: Needs Testing Work has been reviewed and needs the code tested by the quality assurance team. and removed Status: Needs Review PR needs an additional review or a maintainer's review. labels Mar 5, 2021
@CodeChamp-SS
Copy link
Contributor

image
As stated in the pr description, the app apk size has reduced from 4 to nearly 2.3 mb.
Tested the pr locally on emulator as well, the app works perfectly fine.

But I want to ask why have you written lines 28-34 in progaurd-rule.pro ? 🤔
image

@epicadk
Copy link
Member Author

epicadk commented Mar 6, 2021

But I want to ask why have you written lines 28-34 in progaurd-rule.pro ? 🤔

As explained in the docs itself. Those classes are not required for processing. You can see over here that android studio recommended using the -dontwarn option.
image
I tested the app and it was working fine without it so I used the -dontwarn options. I hope this clarifies it. : )

@epicadk
Copy link
Member Author

epicadk commented Mar 6, 2021

image
As stated in the pr description, the app apk size has reduced from 4 to nearly 2.3 mb.
Tested the pr locally on emulator as well, the app works perfectly fine.

But I want to ask why have you written lines 28-34 in progaurd-rule.pro ? 🤔
image

Can you link the images / videos to this as well. Remember to test the release build and not the debug one 😉 .

@CodeChamp-SS
Copy link
Contributor

But I want to ask why have you written lines 28-34 in progaurd-rule.pro ? 🤔

As explained in the docs itself. Those classes are not required for processing. You can see over here that android studio recommended using the -dontwarn option.
image
I tested the app and it was working fine without it so I used the -dontwarn options. I hope this clarifies it. : )

hmm ok 👍

@CodeChamp-SS
Copy link
Contributor

image
As stated in the pr description, the app apk size has reduced from 4 to nearly 2.3 mb.
Tested the pr locally on emulator as well, the app works perfectly fine.
But I want to ask why have you written lines 28-34 in progaurd-rule.pro ? 🤔
image

Can you link the images / videos to this as well. Remember to test the release build and not the debug one 😉 .

which image/video do you want me to link ? And yes i've posted the screenshot for release build only 😂

@epicadk
Copy link
Member Author

epicadk commented Mar 7, 2021

which image/video do you want me to link ? And yes i've posted the screenshot for release build only 😂

The images/video that show that the app is running fine in the release build.

@CodeChamp-SS
Copy link
Contributor

I had tested previously the debug build variant which was working fine, but on testing the release variant, I am not able to login. It shows the error please check your internet connection, even after proper wifi connection.
@epicadk can you please look into this and fix it ?

pr1069testing.mp4

@epicadk
Copy link
Member Author

epicadk commented Mar 7, 2021

@epicadk can you please look into this and fix it ?

It's working for me. Although I just add the proguard rules to the debug build because I can't install unsinged apk on my device. Can you try testing it locally? I'll find a way to install the release apk on my device.

@CodeChamp-SS
Copy link
Contributor

@epicadk can you please look into this and fix it ?

It's working for me. Although I just add the proguard rules to the debug build because I can't install unsinged apk on my device. Can you try testing it locally? I'll find a way to install the release apk on my device.

Is you release apk running fine ? Or are you talking about the debug one ?🤔

@epicadk
Copy link
Member Author

epicadk commented Mar 7, 2021

@CodeChamp-SS the debug build build with the proguard rules set up is working fine. Can't test the release build ad explained above.

@CodeChamp-SS
Copy link
Contributor

@CodeChamp-SS the debug build build with the proguard rules set up is working fine. Can't test the release build ad explained above.

ya the build one is running fine but I am facing issue in the release apk.

@CodeChamp-SS
Copy link
Contributor

@CodeChamp-SS the debug build build with the proguard rules set up is working fine. Can't test the release build ad explained above.

try creating a signed apk using generate signed bundle/apk in build section and then install it either in your emulator or physical device.

@epicadk
Copy link
Member Author

epicadk commented Mar 7, 2021

@CodeChamp-SS the debug build build with the proguard rules set up is working fine. Can't test the release build ad explained above.

try creating a signed apk using generate signed bundle/apk in build section and then install it either in your emulator or physical device.

Yep I was just doing that.

@CodeChamp-SS
Copy link
Contributor

@CodeChamp-SS the debug build build with the proguard rules set up is working fine. Can't test the release build ad explained above.

try creating a signed apk using generate signed bundle/apk in build section and then install it either in your emulator or physical device.

Yep I was just doing that.

hmm so what problem are you facing exactly ? I may be able to help

@epicadk
Copy link
Member Author

epicadk commented Mar 7, 2021

hmm so what problem are you facing exactly ? I may be able to help

Haha thanks but I was just busy with a couple of stuff and never ended up setting up the keystore. The error is due to the file Baseurl.kt if you change the release build url to the current mentorship backend one it will work. However I don't think that is in the scope of this pr. What do you think?

@CodeChamp-SS
Copy link
Contributor

hmm so what problem are you facing exactly ? I may be able to help

Haha thanks but I was just busy with a couple of stuff and never ended up setting up the keystore. The error is due to the file Baseurl.kt if you change the release build url to the current mentorship backend one it will work. However I don't think that is in the scope of this pr. What do you think?

didn't get what you are trying to say 😅

@epicadk
Copy link
Member Author

epicadk commented Mar 8, 2021

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

@CodeChamp-SS
Copy link
Contributor

CodeChamp-SS commented Mar 8, 2021

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

@CodeChamp-SS
Copy link
Contributor

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

but after that also same error is occuring.

@epicadk
Copy link
Member Author

epicadk commented Mar 8, 2021

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

Yes I haven't made any changes to the BaseUrl.kt file. The bug exists even before this pr. You can try to build the release apk from the develop branch and it would still show the same error as for the release build it returns the elastic beanstalk url.

I don't think we need to keep the remote package because it'll work even after obfuscation but if I have missed anything can you explain why we would want to add remote to the keep rules? 🤔

@CodeChamp-SS
Copy link
Contributor

CodeChamp-SS commented Mar 8, 2021

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

Yes I haven't made any changes to the BaseUrl.kt file. The bug exists even before this pr. You can try to build the release apk from the develop branch and it would still show the same error as for the release build it returns the elastic beanstalk url.

oh.. okk

@CodeChamp-SS
Copy link
Contributor

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

Yes I haven't made any changes to the BaseUrl.kt file. The bug exists even before this pr. You can try to build the release apk from the develop branch and it would still show the same error as for the release build it returns the elastic beanstalk url.

oh.. okk

didn't get what you are trying to say 😅

The error please check your internet connection is due to the file baseurl.kt having a different url in the release build. So if you do want to test the release build you can try changing that file and it should work : ).

What changes ? I think BaseUrl.kt file remains the same 🤔. Moreover I think you should do something like -keep class org.systers.mentorship.remote.* {*;} in the proguard-rulers.pro file

I don't think we need to keep the remote package because it'll work even after obfuscation but if I have missed anything can you explain why we would want to add remote to the keep rules? 🤔

Nah don't change anything, I thought maybe adding some of those files might fix this issue. But if it existed previously too then it's fine :-)

@epicadk
Copy link
Member Author

epicadk commented Apr 9, 2021

@vj-codes can you confirm if this can be marked ready to merge as tested by @CodeChamp-SS ? ( The error that is occurring is unrelated to the changes made).

Copy link
Member

@isabelcosta isabelcosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @epicadk 🙌🏾

@isabelcosta isabelcosta added Status: Ready to Merge Work has been tested and needs a final review and merge from a repo maintainer. and removed Status: Needs Testing Work has been reviewed and needs the code tested by the quality assurance team. labels May 15, 2021
@isabelcosta
Copy link
Member

@epicadk so we have an issue with release build right? because of the backend URL? Can you create an issue just to document that for later.

I see @CodeChamp-SS tested the debug apk, I will merge

@isabelcosta isabelcosta merged commit 17912ba into anitab-org:develop May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Ready to Merge Work has been tested and needs a final review and merge from a repo maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Setup R8 for Release build
5 participants