小编Nik*_*ron的帖子

Android 模块之间的视图绑定

模块之间的视图绑定有效吗?

如何重现:创建2个模块>>>在模块1中创建布局1并在模块2中创建布局2>>>在模块1中创建Fragment1,其视图将包括布局1,布局2>>>尝试获取绑定>>>布局1会起作用,因为它与 Fragment1 位于同一模块中,但由于绑定生成错误,layout2 将无法工作

我的例子:

认证模块对公共模块具有依赖关系。

base_button.xml位于公共模块中。

login_input_component.xml位于身份验证模块中,因此没有问题。

但是这个错误发生在loginButton绑定上。

即使 base_button.xml 位于另一个模块中,它也会尝试在身份验证模块中查找 BaseButtonBinding。

在此输入图像描述

所有模块都有:

buildFeatures {
    dataBinding = true
    viewBinding = true
}
Run Code Online (Sandbox Code Playgroud)

data-binding dependencies android module kotlin

16
推荐指数
1
解决办法
1296
查看次数

Parcelables 不支持默认值。Android 导航深层链接参数

在实现传参方案的过程中,在模块间的导航中,遇到了序列化错误。据我所知,Deeplinks 接受自定义参数类型,即 Parcelables 或 Serializable。

我使用的是最新版本的导航 2.2.0

错误信息:

java.lang.UnsupportedOperationException:Parcelables 不支持默认值。

我做错了什么还是仍在开发中?

这是一个简短的例子:

<fragment
    android:id="@+id/sampleFragment"
    android:name="com.testapp.app.samples.navigation.SampleFragment"
    android:label="SampleFragment">
    <argument
        android:name="Args"
        app:argType="com.testapp.navigation.SampleArgs" />
    <deepLink app:uri="app://app/samples/navigation/SampleFragment?Args={Args}"/>
</fragment>
Run Code Online (Sandbox Code Playgroud)
@Parcelize
@Keep data class SampleArgs(
    val text: String
) : NavArgs, Parcelable
Run Code Online (Sandbox Code Playgroud)
val x = SampleArgs("TEST")
val uri = Uri.parse("app://app/samples/navigation/SampleFragment?Args=$x")
navController.navigate(uri)
Run Code Online (Sandbox Code Playgroud)

我在这里发现了类似的东西Android Parcelable 不支持默认值 App Crash

这是我在堆栈上的第一篇文章,所以请保持温柔:)

编辑

这是答案:

https://issuetracker.google.com/issues/148523779

navigation android parcelable deeplink android-safe-args

15
推荐指数
1
解决办法
1076
查看次数

Firebase android 性能 NoClassDefFoundError -&gt; FirebasePerfUrlConnection

有人面临同样的问题吗?将 firebase 性能添加到项目后,启动应用程序后立即发生错误。它仅在调试版本中崩溃,在发布版本中一切都按预期工作。也许有人有真正的答案,因为我在类似问题中发现的所有内容都是通过试错方法来处理库版本。Multidex 已打开。

\n\n

错误:

\n\n
E/AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-2\nProcess: {PROJECT PACKAGE}, PID: 9872\nio.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What\'s-different-in-2.0#error-handling | java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/perf/network/FirebasePerfUrlConnection;\n    at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)\n    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)\n    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)\n    at java.util.concurrent.FutureTask.run(FutureTask.java:266)\n    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)\n    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)\n    at java.lang.Thread.run(Thread.java:919)\n Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/perf/network/FirebasePerfUrlConnection;\n    at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy.createHttpUrlConnection(WalledGardenInternetObservingStrategy.java:124)\n    at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy.isConnected(WalledGardenInternetObservingStrategy.java:107)\n    at com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy$1.apply(WalledGardenInternetObservingStrategy.java:66)\n    at …
Run Code Online (Sandbox Code Playgroud)

android noclassdeffounderror firebase firebase-performance

6
推荐指数
2
解决办法
5981
查看次数