【问题标题】:Unable to Generate Signed APK in Android Studio gives me error with proguard-rules.txt not found?Unable to Generate Signed APK in Android Studio 给了我错误,proguard-rules.txt not found?
【发布时间】:2015-02-24 14:54:30
【问题描述】:

您好,我是 Android Studio 的新手,可以构建和生成签名的 apk 文件。我尝试了很多生成 APK 文件,但我被困在这个问题上。

我找到了一些生成签名apk文件的链接,请在下面查看。

http://xda-university.com/as-a-developer/getting-started-android-studiohttp://www.techotopia.com/index.php/Generating_a_Signed_Release_APK_File_in_Android_Studio

我采用了同样的方法,但在该过程中它没有显示运行 Proguard 选项来检查和生成 apk 文件,请参见下文。

请在此处查看我的以下代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Google Inc.:Google APIs:17'
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.wasl.properties"
        minSdkVersion 9
        targetSdkVersion 17
        versionCode 8
        versionName "2.1"
    }

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

dependencies {
 compile 'com.google.android.gms:play-services:+'
 compile files('libs/commons-codec-1.4.jar')
 compile files('libs/FlurryAnalytics_3.3.0.jar')
 compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')
 compile files('libs/universal-image-loader-1.8.5-with-sources.jar')
 compile 'com.android.support:support-v4:21.0.3'
}

请帮助解决这个问题,在此先感谢。

【问题讨论】:

    标签: android android-studio apk android-gradle-plugin build.gradle


    【解决方案1】:

    在您的 build.gradle 文件中,您为发布版本启用了默认的 proguard 处理步骤。构建过程正在尝试运行 proguard(即minifyEnabled 行)并搜索下面行中指定的文件(根据您的错误消息,这些文件不存在)。

    如果你不想运行 proguard(在这个阶段,我想你不会)你应该删除 release 构建类型的内容:

    buildTypes {
        release {
        }
    }
    

    【讨论】:

    • 感谢 Adam,在尝试使用 run proguard 发布签名构建时,正在搜索不存在的 proguard 文件,然后给我错误 proguard-rules.txt not found in specified location path。我该如何解决这个问题以及如何发布签名版本。
    猜你喜欢
    • 1970-01-01
    • 2015-10-20
    • 2019-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-31
    • 2020-10-24
    相关资源
    最近更新 更多