如何为反射生成的类添加Proguard规则?

时间:2018-11-13 14:15:11

标签: android proguard android-proguard json-schema-validator

这是我所面临的问题所在的班级:

import java.lang.reflect.Constructor;

            /**
             * Keyword validator constructors common to draft v4 and v3
             */
            public final class CommonValidatorDictionary
            {
                private static final Dictionary<Constructor<? extends KeywordValidator>>
                    DICTIONARY;

                private CommonValidatorDictionary()
                {
                }

                public static Dictionary<Constructor<? extends KeywordValidator>> get()
                {
                    return DICTIONARY;
                }

                static {
                    final DictionaryBuilder<Constructor<? extends KeywordValidator>>
                        builder = Dictionary.newBuilder();

                    String keyword;
                    Class<? extends KeywordValidator> c;

                    /*
                     * Arrays
                     */
                    keyword = "additionalItems";
                    c = AdditionalItemsValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "minItems";
                    c = MinItemsValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "maxItems";
                    c = MaxItemsValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "uniqueItems";
                    c = UniqueItemsValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    /*
                     * Numbers and integers
                     */
                    keyword = "minimum";
                    c = MinimumValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "maximum";
                    c = MaximumValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    /*
                     * Objects
                     */
                    keyword = "additionalProperties";
                    c = AdditionalPropertiesValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    /*
                     * Strings
                     */
                    keyword = "minLength";
                    c = MinLengthValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "maxLength";
                    c = MaxLengthValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "pattern";
                    c = PatternValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    keyword = "enum";
                    c = EnumValidator.class;
                    builder.addEntry(keyword, constructor(c));

                    DICTIONARY = builder.freeze();
                }

                private static Constructor<? extends KeywordValidator> constructor(
                    final Class<? extends KeywordValidator> c)
                {
                    try {
                        return c.getConstructor(JsonNode.class);
                    } catch (NoSuchMethodException e) {
                        throw new RuntimeException("No appropriate constructor", e);
                    }
                }
            }

这些是错误日志:

2018-11-09 19:39:42.006 6598-13189 / com.dxp.aci W / System.err:java.lang.RuntimeException:执行doInBackground()时发生错误 2018-11-09 19:39:42.006 6598-13189 / com.dxp.aci W / System.err:at android.os.AsyncTask $ 3.done(AsyncTask.java:325) 2018-11-09 19:39:42.006 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) 2018-11-09 19:39:42.006 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.FutureTask.run(FutureTask.java:242) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:607) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at java.lang.Thread.run(Thread.java:762) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:原因:java.lang.NoClassDefFoundError:decurtis.dxp.documentschema.validator.SchemaValidator 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at decurtis.dxp.documentschema.validator.SchemaValidator.validateDocument(SchemaValidator.java:104) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.json_schema_validation.SchemaValidableDocumentUpdater.update(SchemaValidableDocumentUpdater.java:127) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.couchbase.lite.Document.update(Document.java:376) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.documents.CouchDocumentHelper.saveDocument(CouchDocumentHelper.java:497) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.backend.service.ACI.ACIService.postAlert(ACIService.java:216) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.backend.feature.ACI.ACIFeature.postAlert(ACIFeature.java:98) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.backend.Presenter.ACI.ACIPresenter.postAlert(ACIPresenter.java:537) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.ui.dialog.VCICreateEditAlertDialog $ 1.doInBackground(VCICreateEditAlertDialog.java:186) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at com.android.embarkation.ui.dialog.VCICreateEditAlertDialog $ 1.doInBackground(VCICreateEditAlertDialog.java:167) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at android.os.AsyncTask $ 2.call(AsyncTask.java:305) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:at java.util.concurrent.FutureTask.run(FutureTask.java:237) 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:...还有3个 2018-11-09 19:39:42.007 6598-13189 / com.dxp.aci W / System.err:原因:java.lang.ExceptionInInitializerError 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.CommonValidatorDictionary.a(CommonValidatorDictionary.java:54) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.DraftV3ValidatorDictionary。(DraftV3ValidatorDictionary.java:59) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.DraftV3ValidatorDictionary.a(DraftV3ValidatorDictionary.java:49) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.DraftV3Library。(DraftV3Library.java:32) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.DraftV3Library.a(DraftV3Library.java:45) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder。(ValidationConfigurationBuilder.java:63) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.cfg.ValidationConfiguration.a(ValidationConfiguration.java:92) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.cfg.ValidationConfiguration.b(ValidationConfiguration.java:102) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:在com.github.fge.jsonschema.main.JsonSchemaFactoryBuilder。(JsonSchemaFactoryBuilder.java:68) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.main.JsonSchemaFactory.newBuilder(JsonSchemaFactory.java:123) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.main.JsonSchemaFactory.byDefault(JsonSchemaFactory.java:113) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at decurtis.dxp.documentschema.validator.SchemaValidator。(SchemaValidator.java:48) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:...还有14个 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:原因:java.lang.RuntimeException:没有适当的构造函数 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.CommonValidatorDictionary.a(CommonValidatorDictionary.java:129) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.CommonValidatorDictionary。(CommonValidatorDictionary.java:69) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:...还有26个 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:由以下原因引起:java.lang.NoSuchMethodException:[class com.fasterxml.jackson.databind.JsonNode] 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at java.lang.Class.getConstructor0(Class.java:2204) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at java.lang.Class.getConstructor(Class.java:1683) 2018-11-09 19:39:42.008 6598-13189 / com.dxp.aci W / System.err:at com.github.fge.jsonschema.library.validator.CommonValidatorDictionary.a(CommonValidatorDictionary.java:127)

0 个答案:

没有答案