简体   繁体   English

IllegalMonitorStateException: 对象在 wait() 之前未被线程锁定,使用同步静态方法

[英]IllegalMonitorStateException: object not locked by thread before wait(), using synchronized static method

I have already read about this question but my case I think is different: IllegalMonitorStateException on wait() call我已经读过这个问题,但我认为我的情况有所不同: IllegalMonitorStateException on wait() call

I'm using java on Android studio.我在 Android Studio 上使用 java。 The error I get it is the following:我得到的错误如下:

MiniatureAnnotations: Problem annotating via GMS.
    java.lang.IllegalMonitorStateException: object not locked by thread before wait()
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:422)
        at jaw.a(PG:20)
        at hnt.b(PG:115)
        at com.google.android.apps.messaging.shared.datamodel.action.GenericWorkerQueueAction.b(PG:81)
        at eqs.run(PG:1)
        at yya.run(PG:3)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at yws.run(PG:4)
        at java.lang.Thread.run(Thread.java:764)

I'm not using a lock on an object but synchronized the method.我没有在对象上使用锁,而是同步了方法。 Such as:如:

public synchronized static boolean send(Repository repository, Context context) {
   //  code... [I do not use wait or notify]
}

or:或者:

 public static synchronized void checkWorkers(Context context) {
        WorkManager workManager = WorkManager.getInstance(context);
        ListenableFuture<List<WorkInfo>> senderWorker = workManager.getWorkInfosByTag(tagSenderWorker);
        if (senderWorker.isCancelled()) {
            PeriodicSmsWorker.initializePeriodicSmsWorker(context, REPLACE_POLICY);
            updateCheckSenderWorker();
    } else if (System.currentTimeMillis() - LAST_CHECK_SENDER_WORKER > MAX_TIME_WORKER_INACTIVE) {
        updateCheckSenderWorker();
        PeriodicSmsWorker.initializePeriodicSmsWorker(context, REPLACE_POLICY);
    }
}

Why am I getting IllegalMonitorStateException if I do not use wait or notify?如果我不使用等待或通知,为什么会收到 IllegalMonitorStateException?

Edit1: disable Dexguard based on: How to disable Dexguard?编辑 1:禁用 Dexguard 基于: 如何禁用 Dexguard?

in gradle app:在gradle应用程序中:

buildTypes {
        release {
            //minifyEnabled false
            minifyEnabled rootProject.ext.enableDexGuardPlugin
            //proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
dependencies {
    ...
    apply plugin: 'com.android.application'
    if(rootProject.ext.enableDexGuardPlugin) {
        apply plugin: 'dexguard'
    }
}

gradle project:毕业项目:

 ext {
        roomVersion = '2.2.0-beta01'
        archLifecycleVersion = '2.2.0-alpha03'
        coreTestingVersion = "2.1.0-rc01"
        enableDexGuardPlugin = false
    }

However I have the same error.但是我有同样的错误。

The offensive invocation of wait() is made from the method jaw.a . wait()的攻击性调用是通过方法jaw.a If you cannot find its real name, then disable DexGuard, rebuild and run your application again.如果您找不到它的真实名称,请禁用 DexGuard,重新构建并再次运行您的应用程序。 The stack trace should show the exact place where wait() without synchronized is invoked.堆栈跟踪应该显示调用没有synchronized wait()的确切位置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:java.lang.IllegalMonitorStateException:对象在wait()之前未被线程锁定 - Android: java.lang.IllegalMonitorStateException: object not locked by thread before wait() java.lang.IllegalMonitorStateException:对象在wait()之前未被线程锁定 - java.lang.IllegalMonitorStateException: object not locked by thread before wait() Android java.lang.IllegalMonitorStateException:对象在wait()之前未被线程锁定 - Android java.lang.IllegalMonitorStateException: object not locked by thread before wait() java.lang.IllegalMonitorStateException:在等待()之前对象没有被线程锁定? - java.lang.IllegalMonitorStateException: object not locked by thread before wait()? IllegalMonitorStateException:对象在notify()之前没有被线程锁定 - IllegalMonitorStateException: object not locked by thread before notify() IllegalMonitorStateException在其run方法内部的线程上调用wait()(无同步块) - IllegalMonitorStateException calling wait() on a thread inside its run method (with no synchronized block) 在wait()之前对象没有被线程锁定? - Object not locked by thread before wait()? 在notifyAll()之前未被线程锁定的同步对象 - synchronized object not locked by thread before notifyAll() CountDownLatch:对象在等待()之前未被线程锁定 - CountDownLatch: object not locked by thread before wait() @Synchronized 方法中的 Kotlin IllegalMonitorStateException - Kotlin IllegalMonitorStateException in @Synchronized method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM