首页 > 解决方案 > 删除 Android 错误 java.lang.IllegalArgumentException: Service Intent must be explicit: Intent from another class

问题描述

我目前正在开发一个 android 项目,并且一直遇到错误 java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=cn.ingenic.glasssync.SYNC_SERVICE }

我知道较新版本的android需要明确的服务意图,但是它所指的服务意图在导入的类文件SyncModule.java中

private final void bind(IBinder service) {
        if (this.mService != null) {
            Log.d("SyncModule", "Module:" + this.mName + " already bonded.");
        } else {
            if (service == null) {
                Intent intent = new Intent("cn.ingenic.glasssync.SYNC_SERVICE");
                this.mContext.bindService(intent, this.mServiceConnection, 1);
            } else {
                this.mService = Stub.asInterface(service);
                if (this.mService != null) {
                    try {
                        this.mService.registModule(this.mName, this.mCallback);
                    } catch (RemoteException var3) {
                        Log.e("SyncModule", "", var3);
                    }
                }
            }

        }
    }

它打破的地方是在当地的班级

public SmsModule(String name, Context context) {

        super(name, context, true);

它从它的 SyncModule 类调用构造函数,因为这是一个继承的类文件,我无法编辑源代码是否有任何解决方法可以解决此错误?

标签: javaandroidclassinheritance

解决方案


推荐阅读