java - 错误 :Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'

标签 java android debugging proguard

我必须在我的项目中使用某些库。 当我想要 bebu 我的应用程序时,我收到一个指示,告诉我我的代码超过 65k 方法。 因此我决定使用 Proguard。 但是我收到这个错误。 我的buile.gradle代码

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "transplusafrica.delydress"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    } 
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.squareup:otto:1.3.8'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.android.gms:play-services-maps:9.2.0'
    compile 'com.google.android.gms:play-services-gcm:9.2.0'
   compile 'com.google.android.gms:play-services-location:9.2.0'
 }

我收到这个错误

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'.

java.io.IOException: proguard.ParseException: Expecting type and name instead of just '' before '(' in line 114 of file 'C:\Users\AMANI\AndroidStudioProjects\DelyDress\app\build\intermediates\proguard-rules\debug\aapt_rules.txt' Warning:Exception while processing task java.io.IOException: proguard.ParseException: Expecting type and name instead of just '' before '(' in line 114 of file 'C:\Users\AMANI\AndroidStudioProjects\DelyDress\app\build\intermediates\proguard-rules\debug\aapt_rules.txt' :app:transformClassesAndResourcesWithProguardForDebug FAILED

最佳答案

在我的例子中,它是 aapt_rules.txt 中包含我的布局文件的 -keepclassmembers 行。检查此布局后,我发现 android:onClick="" 参数为空。删除它可以解决我的问题。

关于java - 错误 :Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38436236/

相关文章:

java - SoLR 中具有特殊字符的字段排序

java - 如何在 JPQL 中执行 EAGER 获取

安卓 NDK java.lang.UnsatisfiedLinkError : findLibrary returned null when Multidex enabled

swift - 如何消除导致此线程 1 : EXC_BAD_ACCESS error? 的错误

java - 收到 GAE 响应时如何处理 JsonSyntaxException

java - 保存到特定目录

java - Android JSON解析

android - 本地单元测试中 Build.VERSION.SDK_INT 的 stub 值

javascript 在事件发生之前触发

c++ - 什么是 Debug模式 w.r.t C++?