Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning:can't find referenced class

There is method called onDelete in a Kotlin class.

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())
                        }, {})
            }
    }
}

When I build release-apk, I enable proguard but it failed because of below warning.

Warning: com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1$2: can't find referenced class com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1

When I use dex2jar to retrieve this class from debug-APK. I got this.

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);
    }
    });
}

I don't know:

  • Who is com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1$2
  • Who is com.uniquestudio.android.iemoji.module.library.customtemplate.MyTemplatePresenter$onDelete$1$1
  • Why the first can't find referenced class
like image 740
CoXier Avatar asked Oct 12 '18 01:10

CoXier


1 Answers

Seems to be a kotlin issue, the issue can be watched here: https://youtrack.jetbrains.com/issue/KT-16084

Rewrite the apply and everything should work...

like image 130
prom85 Avatar answered Nov 08 '22 09:11

prom85