Large number of errors during Gradle build after upgrading to Android Studio 2.0

前端 未结 7 1368
青春惊慌失措
青春惊慌失措 2020-12-07 20:55

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

相关标签:
7条回答
  • 2020-12-07 21:05

    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.

    0 讨论(0)
  • 2020-12-07 21:05

    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
        }
    }
    
    0 讨论(0)
  • 2020-12-07 21:05

    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.** { *; }
    
    0 讨论(0)
  • 2020-12-07 21:14

    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.

    0 讨论(0)
  • 2020-12-07 21:17

    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.

    0 讨论(0)
  • 2020-12-07 21:17

    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'
        }
    }
    
    0 讨论(0)
提交回复
热议问题