0

我已经创建了一个新的空项目,并正在尝试使用 proguard 签名的 apk 文件。我的 gradle 文件是这样的:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.goldpc.testproguard2"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

但是当我尝试释放时,我收到一条错误消息:

错误:任务“:app:proguardRelease”执行失败。

java.net.URISyntaxException:索引 2 处不透明部分中的非法字符:f:\Android\sdk\platforms\android-21\android.jar

项目只是为了测试而创建的——它意味着标准的“Hello World”项目。我试图compileSdkVersion从 21 更改为 19,但它再次崩溃。当我禁用时,proguard我可以创建签名的 apk 文件。但我需要在启用 proguard 的情况下使用它。

4

1 回答 1

1

Very interesting but i think i found the solution accidentally. When I build project in windows 8 and its system language turkish i gets this error. Then today i install android studio in my mac then when i try to build project without ProGuard android studio gives language error then i searched on net JDK 7 causes error when system language was non-english. Then i changed my computers system languages to english surprisedly it works in two machine with ProGuard , all errors gone.

于 2015-03-11T14:14:21.643 回答