警告:找不到参考的课程

时间:2018-10-12 01:59:43

标签: java android kotlin proguard

Kotlin类中有一个称为onDelete的方法。

override fun onDelete(position: Int) {
    templates?.apply {
         val deleteDialog = DeleteTemplateDialog(view.getViewContext())
            deleteDialog.confirmListener = {
                CustomTemplateRepository.getInstance().deleTemplate(this[position].templateId!!)
                        .subscribe({
                            deleteDialog.dismiss()
                            this.removeAt(position)
                            customTemplateAdapter?.notifyDataSetChanged()
                            view.showEmptyView(this.isEmpty())
                        }, {})
            }
    }
}

在构建release-apk时,我启用了proguard,但由于以下警告而失败。

  

警告:com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter $ onDelete $ 1 $ 1 $ 2:找不到引用的类com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter $ onDelete $ 1 $ 1

当我使用dex2jar从debug-APK检索此类时。我明白了。

public void onDelete(final int paramInt)
{

    final DeleteTemplateDialog localDeleteTemplateDialog = new DeleteTemplateDialog(this.view.getViewContext());
    localDeleteTemplateDialog.setConfirmListenner((Function0)new Lambda(localArrayList)
    {
    public final Disposable invoke()
    {
        CustomTemplateRepository localCustomTemplateRepository = CustomTemplateRepository.Companion.getInstance();
        String str = ((Template)this.receiver$0.get(paramInt)).getTemplateId();
        if (str == null) {
        Intrinsics.throwNpe();
        }
        localCustomTemplateRepository.deleTemplate(str).subscribe((Action)new Action()
        {
        public final void run()
        {
            this.this$0.$deleteDialog.dismiss();
            this.this$0.receiver$0.remove(this.this$0.$position$inlined);
            CustomTemplateAdapter localCustomTemplateAdapter = MyTemplatePresenter.access$getCustomTemplateAdapter$p(this.this$0.this$0);
            if (localCustomTemplateAdapter != null) {
            localCustomTemplateAdapter.notifyDataSetChanged();
            }
            this.this$0.this$0.getView().showEmptyView(this.this$0.receiver$0.isEmpty());
        }
        }, (Consumer)MyTemplatePresenter.onDelete.1.1.2.INSTANCE);
    }
    });
}

我不知道:

  • 谁是com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1$2
  • 谁是com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1
  • 为什么第一个找不到引用的类

1 个答案:

答案 0 :(得分:0)

似乎是kotlin问题,可以在此处查看此问题: https://youtrack.jetbrains.com/issue/KT-16084

重写apply,一切正常...