Too many method references in android library project - ClassNotFoundException

梦想与她 提交于 2019-12-05 17:46:51

First of all, check out the official documentation - it explains how to add multi-dex support in great detail.

Answers:

Do I need to add multi-dex support in both library as well as main android project?

Specify 'multiDexEnabled = true' (under defaultConfig) only in main Android project. No need to declare it in libraries.

Do I need to add afterEvaluate script in both project?

v0.14.0 of Gradle plugin for Android added support for multi-dex and you no longer need to add the code that you mentioned. The plugin will automatically create the main dex list and will pass the required information to dex process.

Post the results, and let us know if you still have ClassNotFoundException errors.

I'm receiving the following error when trying to build a release variant with proguard:
Warning: com.amazonaws.AmazonWebServiceClient: can't find referenced class org.apache.commons.logging.LogFactory

In their github repo, AWS authors included instructions for how to setup proguard configuration:

-keep class org.apache.commons.logging.**               { *; }
-keep class com.amazonaws.services.sqs.QueueUrlHandler  { *; }
-keep class com.amazonaws.javax.xml.transform.sax.*     { public *; }
-keep class com.amazonaws.javax.xml.stream.**           { *; }
-keep class com.amazonaws.services.**.model.*Exception* { *; }
-keep class com.amazonaws.internal.**                   { *; }
-keep class org.codehaus.**                             { *; }
-keep class org.joda.convert.*                          { *; }
-keepattributes Signature,*Annotation*,EnclosingMethod
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class com.amazonaws.** { *; }

-dontwarn com.amazonaws.auth.policy.conditions.S3ConditionFactory
-dontwarn org.joda.time.**
-dontwarn com.fasterxml.jackson.databind.**
-dontwarn javax.xml.stream.events.**
-dontwarn org.codehaus.jackson.**
-dontwarn org.apache.commons.logging.impl.**
-dontwarn org.apache.http.conn.scheme.**
-dontwarn org.apache.http.annotation.**
-dontwarn org.ietf.jgss.**
-dontwarn org.w3c.dom.bootstrap.**

Note that your proguard config is missing the org.apache.commons.logging.** entry.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!