我必须在我的项目中使用某些库。 当我想要 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/