最近在重构代码,将代码进行模块化开发,分为library和app,成功安装启动,点击页面时,报以下错误:
Process: com.cxyx.wms.pda.outbound, PID: 30237
java.lang.NoSuchFieldError: No static field item of type I in class Lcom/cxyx/wms/pda/outbound/BR; or its superclasses (declaration of 'com.cxyx.wms.pda.outbound.BR' appears in /data/app/com.cxyx.wms.pda.outbound-1/base.apk:classes2.dex)
at com.cxyx.wms.pda.outbound.databinding.OutboundTransferPickingFragmentOverviewBindingImpl.setItem(OutboundTransferPickingFragmentOverviewBindingImpl.java:120)
at com.cxyx.wms.pda.outbound.transfer.v3.picking.page.TransferPickingOverviewFragment.initView(TransferPickingOverviewFragment.java:75)
at com.cxyx.wms.pda.app.AbsBaseFragmentBinding.onViewCreated(AbsBaseFragmentBinding.java:78)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
解决:检查models的AndroidManifest.xml的package name是否与其他的model中的package name重复。我的就是library的package name和app的重复导致的。
网友评论