nextcloud / notes-android

✎ Android client for Nextcloud Notes app.
https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes
GNU General Public License v3.0
938 stars 134 forks source link

4.3.0 RC1 notes preview crash #2193

Closed vanycon closed 5 months ago

vanycon commented 5 months ago

This issue respects the following points:

Describe the bug

  1. Start or open the app
  2. Click on a note
  3. Click on preview (if last state was already preview, error will trigger directly after 2.) -> error (clearing cash or reinstallation does not solve it):
    
    App Version: 4.3.0 RC1
    App Version Code: 40030051
    App Flavor: play

Files App Version Code: 30290090 (PROD)


OS Version: 5.10.189-android13-4-00012-g1217bb583cc5-ab11174560(11583682) OS API Level: 34 Device: bluejay Manufacturer: Google Model (and Product): Pixel 6a (bluejay)


android.view.InflateException: Binary XML file line #39 in it.niedermann.owncloud.notes:layout/fragment_note_preview: Binary XML file line #39 in it.niedermann.owncloud.notes:layout/fragment_note_preview: Error inflating class it.niedermann.android.markdown.MarkdownViewerImpl Caused by: android.view.InflateException: Binary XML file line #39 in it.niedermann.owncloud.notes:layout/fragment_note_preview: Error inflating class it.niedermann.android.markdown.MarkdownViewerImpl Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:742) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:894) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:849) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1011) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:972) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1014) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:972) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1014) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:972) at android.view.LayoutInflater.inflate(LayoutInflater.java:570) at android.view.LayoutInflater.inflate(LayoutInflater.java:462) at it.niedermann.owncloud.notes.databinding.FragmentNotePreviewBinding.inflate(FragmentNotePreviewBinding.java:77) at it.niedermann.owncloud.notes.edit.NotePreviewFragment.onCreateView(NotePreviewFragment.java:114) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3115) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:569) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2103) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1998) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1941) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:661) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8501) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lscheme/DynamicScheme; at it.niedermann.android.markdown.ThemeUtils$tintDrawable$1.invoke(ThemeUtils.kt:38) at com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase.withScheme(ViewThemeUtilsBase.kt:43) at it.niedermann.android.markdown.ThemeUtils.tintDrawable(ThemeUtils.kt:38) at it.niedermann.android.markdown.markwon.plugins.mentions.MentionsPlugin.getTintedDrawable(MentionsPlugin.java:164) at it.niedermann.android.markdown.markwon.plugins.mentions.MentionsPlugin.setColor(MentionsPlugin.java:156) at it.niedermann.android.markdown.markwon.plugins.mentions.MentionsPlugin.(MentionsPlugin.java:66) at it.niedermann.android.markdown.markwon.plugins.mentions.MentionsPlugin.create(MentionsPlugin.java:71) at it.niedermann.android.markdown.markwon.MarkwonMarkdownViewer.createMarkwonBuilder(MarkwonMarkdownViewer.java:142) at it.niedermann.android.markdown.markwon.MarkwonMarkdownViewer.(MarkwonMarkdownViewer.java:99) at it.niedermann.android.markdown.markwon.MarkwonMarkdownViewer.(MarkwonMarkdownViewer.java:79) at it.niedermann.android.markdown.MarkdownViewerImpl.(MarkdownViewerImpl.java:18) ... 30 more Caused by: java.lang.ClassNotFoundException: scheme.DynamicScheme ... 41 more



### Expected behavior

_No response_

### Notes Android version

4.3.0 RC1

### Notes server version

4.10.0

### Nextcloud Android version

3.29.0

### Nextcloud version

28.0.3 (Hetzner Storage Share)

### Device

Google Pixel 6a

### Android Version

14

### App Store

- [X] Google Play Store
- [ ] F-Droid
- [ ] Huawei App Gallery

### Stacktrace

_No response_
stefan-niedermann commented 5 months ago

cc @AndyScherzinger

AndyScherzinger commented 5 months ago

Cc @alperozturk96 @tobiasKaminsky

AndyScherzinger commented 5 months ago

@stefan-niedermann the stack trace puzzles me a bit, because

Caused by: java.lang.ClassNotFoundException: scheme.DynamicScheme

with the currently used android-common v0.20.0 we ship https://github.com/nextcloud/android-common/pull/365 which comes with a repackaging by Google themselves from their material classes. So this class would be expected at dynamiccolor.DynamicScheme. And that is the version used on the notes app and in your markdown library.

So this needs further investigation where it is pulling an old lib code from...

stefan-niedermann commented 5 months ago

So isn't the root cause actually a dependency conflicz resolution issue? I will happily upgrade and publish a new version of the lib, but this will not prevent future issue like this...?

alperozturk96 commented 5 months ago

So isn't the root cause actually a dependency conflicz resolution issue? I will happily upgrade and publish a new version of the lib, but this will not prevent future issue like this...?

Are we using try catch block inside the constructor of some class that used in MarkdownViewerImpl?

AndyScherzinger commented 5 months ago

So isn't the root cause actually a dependency conflicz resolution issue? I will happily upgrade and publish a new version of the lib, but this will not prevent future issue like this...?

Yes, the root cause it a dependency resolution issue with the markdown lib fetch 0.19.0 while all other libs are already on 0.20.0, so yeah, quick fix would be to exclude common lib dependency from the markwon lib in the app's dependency list.

I am about to release android-common version 0.21.0 so an update to that version of the dependency would be great. Than we can bump the dependency here and next week @tobiasKaminsky can you another RC then.

alperozturk96 commented 5 months ago

So isn't the root cause actually a dependency conflicz resolution issue? I will happily upgrade and publish a new version of the lib, but this will not prevent future issue like this...?

Yes, the root cause it a dependency resolution issue with the markdown lib fetch 0.19.0 while all other libs are already on 0.20.0, so yeah, quick fix would be to exclude common lib dependency from the markwon lib in the app's dependency list.

I am about to release android-common version 0.21.0 so an update to that version of the dependency would be great. Than we can bump the dependency here and next week @tobiasKaminsky can you another RC then.

I am not sure, I would like to get your opinion. Can it be related something like this?

AndyScherzinger commented 5 months ago
+--- com.github.stefan-niedermann.nextcloud-commons:markdown:2.2.0
|    +--- com.github.stefan-niedermann.nextcloud-commons:ocs:2.2.0
|    |    +--- com.squareup.retrofit2:retrofit:2.11.0 (*)
|    |    +--- com.github.nextcloud:Android-SingleSignOn:1.1.0 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.23 -> 1.9.24 (*)
|    +--- com.github.nextcloud:android-common:0.19.0
|    |    +--- com.github.nextcloud.android-common:core:0.19.0 -> 0.20.0 (*)
|    |    +--- com.github.nextcloud.android-common:material-color-utilities:0.19.0 -> 0.20.0 (*)
|    |    \--- com.github.nextcloud.android-common:ui:0.19.0 -> 0.20.0 (*)

This is the issue I think

AndyScherzinger commented 5 months ago

@stefan-niedermann I created https://github.com/stefan-niedermann/nextcloud-commons/pull/277 for your convenience. Feel free to ping me if/when you did a release and then I can bump the dependencies over here.

stefan-niedermann commented 5 months ago

@AndyScherzinger ping :slightly_smiling_face: stefan-niedermann:nextcloud-commons:2.3.0 has been released. Thanks!

AndyScherzinger commented 5 months ago

Thanks @stefan-niedermann, Main and stable branch have been bumped 👍

AndyScherzinger commented 5 months ago

Issue to be resolved with 4.3.0 RC2