使用databinding和viewmodel构建的项目,成功云端打包后,打开原生页面发生了错误
在manifest.json中添加了
"buildFeatures": {
"dataBinding": true, //开启dataBinding
"viewBinding": true //开启viewBinding
}
报错的代码()
@Override
protected TaskDetailViewModel createViewModel() {
return new ViewModelProvider(this).get(TaskDetailViewModel.class);
}
报错信息
No direct method <init>(Landroidx/lifecycle/ViewModelStoreOwner;)V in class Landroidx/lifecycle/ViewModelProvider; or its super classes (declaration of 'androidx.lifecycle.ViewModelProvider' appears in /data/app/~~PIqjgpkPjaNp2_Q5Lym5kA==/com.cetc28.appWpCNPC-Am2aynW2p2q67RgsY1y5Gw==/base.apk)
0 个回复