错误:程序类型已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy

时间:2018-12-01 07:27:24

标签: java android android-studio gradle android-gradle

我收到此错误:

程序类型已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy消息{种类=错误,文本=程序已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy,sources = [未知源文件],工具名称= Optional.of(D8)}

应用插件:“ com.android.application”

class SingleUseSerializer():

    def __init__(self, userdata, model, many=False, fields=None, exclude=None):
        if not fields and not exclude:
            cprint("SingleUseSerializer: fields and exclude are both None, can only have one.", "red")
        if fields and exclude:
            cprint("SingleUseSerializer: fields and exclude are both present, can only have one.", "red")
        self.main_serializer = {
            "model": model,
            "many": many,
            "fields": fields,
            "exclude": exclude
        }
        self.extra_serializers = {}
        self.userdata = userdata

    def load_extra_serializer(self, model, return_name, many=False, fields=None, exclude=None):
        self.extra_serializers[return_name] = {
            "model": model,
            "many": many,
            "fields": fields,
            "exclude": exclude
        }

    def checkout(self, query):

        def getSerializerClass(name):
            class A(serializers.ModelSerializer):
                def __init__(self, *args, **kwargs):
                    x = kwargs.get("fields", None)
                    if x:
                        self.Meta.fields = x
                        self.Meta.exclude = None
                        del kwargs["fields"]
                    y = kwargs.get("exclude", None)
                    if y:
                        self.Meta.exclude = y
                        self.Meta.fields = None
                        del kwargs["exclude"]
                    if not x and not y:
                        self.Meta.exclude = ('updated', 'created',)
                        self.Meta.fields = None
                    super(A, self).__init__(*args, **kwargs)
                class Meta:
                    model = None
            return type(name, (A,), {})

        main_serializer_class = getSerializerClass(name="MainSerializer")

        for k, v in self.extra_serializers.items():
            inner_serializer_class = getSerializerClass(name=str(k))
            inner_serializer_class.Meta.model = v["model"]
            inst = inner_serializer_class(many=True, fields=v["fields"])
            setattr(main_serializer_class, str(k), inst)
            self.main_serializer["fields"] += (str(k),)

        main_serializer_class.Meta.model = self.main_serializer["model"]
        x = main_serializer_class(query, context={"userdata": self.userdata}, fields=self.main_serializer["fields"])
        return x.data

0 个答案:

没有答案