【问题标题】:Android Studio gives me Execution failed for task ':library:proguardRelease' error after updating to Android Studio 1.0.1更新到 Android Studio 1.0.1 后,Android Studio 给我 Execution failed for task ':library:proguardRelease' 错误
【发布时间】:2023-03-20 00:54:01
【问题描述】:

我将我的 Android Studio 更新到 1.0.1。我按照本教程http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 并从runProguard 更改为minifyEnabled true。我也在我的图书馆项目中改变了它。当我尝试编译时,它给了我Error:Execution failed for task ':> java.io.FileNotFoundException: ProjectName\library\proguard-rules.txt (The system cannot find the file specified)。我为此进行了研究,并找到了解决方案。我在该文件夹中添加了空白 proguard-rules.txt 文件。尝试编译后,它给了我更多错误。现在的主要错误是它cannot find symbol class PageIndicator,这是我图书馆的课程。我什至不知道我能做些什么。

我项目的 build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.miesto.meniu"
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':library')
    compile files('libs/volley.jar')
    compile 'com.google.android.gms:play-services:6.1.71'
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.squareup.picasso:picasso:2.3.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.0@aar'
    compile('com.google.api-client:google-api-client-xml:1.17.0-rc') {
        exclude group: 'com.google.android.google-play-services'
    }
    compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
    compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
        exclude group: 'com.google.android.google-play-services'
    }
    compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
}

我的库的 build.gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:21.0.0'
}

我做错了什么?

【问题讨论】:

  • 将适当的规则添加到 proguard-android.txt 以告诉 ProGuard -keep 您的库的公共 API。
  • proguard-android.txt 位于此处 C:\sdk\tools\proguard\proguard-android.txt ?我该怎么做?
  • 糟糕,抱歉,我抓错了文件名。我的意思是您添加到项目中的proguard-rules.txt。我为我的错误道歉。
  • 我不确定我是否必须这样写:-keep class com.viewpagerindicator.**?
  • 这可能行得通,其中一行或多行表明您不能重命名或删除哪些类。

标签: android android-studio android-library build.gradle


【解决方案1】:

当我删除我的图书馆并再次添加它时,我解决了这个问题。

【讨论】:

  • 嗨,但在我的情况下,我正在尝试使用现有的 Eclipse 密钥库发布已签名的 apk,这就像在指定路径上找不到 proguard-rules.txt 文件一样。我该怎么办?感谢您的及时回复。
  • 首先尝试将空白的proguard-rules.txt放到指定位置。
猜你喜欢
  • 2016-07-15
  • 2022-11-17
  • 1970-01-01
  • 1970-01-01
  • 2021-02-19
  • 2022-01-16
  • 1970-01-01
  • 1970-01-01
  • 2016-06-19
相关资源
最近更新 更多