Recently, I upgraded Android Studio from version 1.5 to 2.0 but since then I observe that the number of errors and warnings has increased. Most of the errors do not make sen
Adding -keepattributes EnclosingMethod
to proguard rules suppresses these errors and warnings.
Worked for me like a charm.
Update :
Adding -keepattributes EnclosingMethod
to proguard rules actually changes how the classes are obfuscated. This preserves the optional attributes that are typically necessary for your code to be executed WITHOUT such issue.
Have you tried to clear the project and rebuild ? In the build.gradle file what version on gradle do you have ?
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
The answer should be here NewRelic causing build errors
add in proguard-rules.pro
-keep class org.apache.commons.beanutils.** { *; }
-keep interface org.apache.commons.beanutils.** { *; }
-keep enum org.apache.commons.beanutils.** { *; }
After last update to Android Studio 2.2 beta, I solved problem by updating "buildToolsVersion" to last possible version (from 24 to 24.0.1) in app build.gradle.
You can get rid of the meaningless warnings and errors by deleting the .idea
folder that Android Studio 1.5 created and importing the the project into Android Studio 2.0 as a gradle project. It will recreate the .idea
folder automatically.
building the Common Collections would produce the required JARs ...
my build.gradle
looks about like this, with commons-collections
excluded & substituted with a more recent version (one still needs to build from source, just as the message tells one to do):
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile 'commons-collections:commons-collections:3.2.2'
// compile 'org.apache.commons:commons-collections4:4.1'
compile ('org.apache.velocity:velocity:1.7') {
exclude group: 'commons-collections', module: 'commons-collections'
}
}