-
Notifications
You must be signed in to change notification settings - Fork 612
Fix #3504 and #3669: Fixed app crashes in API 19 #3723
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
Conversation
| "androidx.core:core:1.0.1": "androidx.core:core:1.3.0", | ||
| "androidx.recyclerview:recyclerview:1.0.0": "androidx.recyclerview:recyclerview:1.1.0", | ||
| "androidx.test:core:1.0.0": "androidx.test:core:1.2.0", | ||
| "com.squareup.okhttp3:okhttp:3.12.12": "com.squareup.okhttp3:okhttp:4.1.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.
@BenHenning After downgrading the deps I ran the
REPIN=1 bazel run @unpinned_maven//:pin which was successful but now its showing 2 versions of same library.
I think this might be because of Retrofit library.
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.
This seems really problematic. We need to be able to update to newer versions otherwise we might lose out on security patches.
Did OkHttp officially drop support for pre-SDK 21?
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.
square/okhttp#4481 paints a pretty clear picture here. We might need to find a different HTTP library to use instead of OkHttp since their <21 compatibility store isn't great. Retrofit will probably force us to use a newer version of OkHttp.
I'm not sure on next steps yet. Retrofit seems to only support OkHttp, and we would either need to backport Retrofit support (limiting our update choices) or find an alternative. For alternatives, I've looked into gRPC (which would be better long-term, anyway), but App Engine doesn't currently support gRPC (or rather, its load balancer will block gRPC traffic).
We could potentially compile out the data module to remove the dependency entirely but that requires shipping the app with Bazel and we can't do that until the app bundles portion of #2432 is addressed. I think that's currently in progress, but probably won't be ready for a few more weeks. We could look into manually building the AAB temporarily, but per Android developer documentation that's probably going to be difficult with databinding (can't be sure until we try, but it requires manually running aapt2 to build out resources).
Finally, we could manually force the data module out of the app via Gradle but that may result in a potential risk to regress existing tests that expect everything to hook-up correctly.
I actually think our hands might be tied here--I don't see an obvious way forward that may not result in a large time commitment to make this work.
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.
Update: Per #2432 (comment) if we can build AABs via Bazel then we can isolate the data module for SDK 19 devices. It doesn't solve the long-term solution, but it might be a viable workaround to at least unblock the immediate need to have SDK 19 support in Alpha MR3.
|
@BenHenning I am unable to fix the test failures for robolectric and build binary for bazel. I am getting following error when executing this on gradle: Can you please help in this? If this fix is urgent, you can contribute on this PR directly. |
BenHenning
left a comment
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.
| import org.oppia.android.util.data.AsyncResult | ||
| import org.oppia.android.util.data.DataProviders.Companion.toLiveData | ||
| import org.oppia.android.util.statusbar.StatusBarColor | ||
| import java.util.Optional |
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.
Can you add a regex pattern check + test in our new regex static analysis check to ensure this can't regress anywhere in the app?
| "androidx.core:core:1.0.1": "androidx.core:core:1.3.0", | ||
| "androidx.recyclerview:recyclerview:1.0.0": "androidx.recyclerview:recyclerview:1.1.0", | ||
| "androidx.test:core:1.0.0": "androidx.test:core:1.2.0", | ||
| "com.squareup.okhttp3:okhttp:3.12.12": "com.squareup.okhttp3:okhttp:4.1.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.
This seems really problematic. We need to be able to update to newer versions otherwise we might lose out on security patches.
Did OkHttp officially drop support for pre-SDK 21?
| private val oppiaLogger: OppiaLogger, | ||
| private val headerViewModelProvider: ViewModelProvider<NavigationDrawerHeaderViewModel>, | ||
| private val footerViewModelProvider: ViewModelProvider<NavigationDrawerFooterViewModel>, | ||
| private val developerOptionsStarter: Optional<DeveloperOptionsStarter> |
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.
Won't this cause build errors if in prod builds of the app? I'm fairly certain we need to keep this.
Can you try using the Guava Optional, instead, to see if it builds? That's a drop-in replacement in Dagger for Java 8 Optional.
|
Unassigning @BenHenning since the review is done. |
|
Hi @rt4914, it looks like some changes were requested on this pull request by @BenHenning. PTAL. Thanks! |
The screenshot is missing a lot of details--I can't help based on this information alone. Can you provide the full stacktrace? I'm also wondering if this fix will actually be sufficient per my other comment. If we're still pulling in newer OkHttp due to Retrofit, this might not actually fix the underlying issue. |
|
Other idea: we might be able to just remove the OkHttp client construction in NetworkModule locally, but it's not clear how much this should bubble up. |
|
Hi @rt4914, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 3 days, it will be automatically closed so that others can take up the issue. |
|
@rt4914 Is this solving the Bazel APK or this is just for the Gradle? |
|
Hi @rt4914, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 3 days, it will be automatically closed so that others can take up the issue. |

Explanation
Fixes #3504 : App crash fixed for API 19.
Fixes #3669: App crash fixed for API 19.
There were two errors occurring on API 19:
Error 1
On launch of app:

java.lang.exceptionininitializererrorwhich was pointing at this.Solution 1
As per this the solution was to downgrade the
okhttpbased libraries from4.x.xto3.x.x.Error 2
On click on any profile in

ProfileChooserapp was crashing. It was because of use ofOptionalhereSolution 2
Get rid of optional as the code can work without that too.
The developer options is working correctly.
Note
I haven't tested the app beyond these screens. So this PR only solves these errors but there should be a full audit on API 19 so that if there are any errors/crashes on any other screen too, we can identify them.
Checklist