Sop*_*hie 11 android proguard android-gradle-plugin
我无法使用minifyEnabled true和生成签名APKshrinkResources true
应用级别:build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "......."
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
}
dependencies {
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.apis:google-api-services-youtube:v3-rev149-1.20.0'
compile 'com.google.http-client:google-http-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.github.clans:fab:1.6.2'
}
Run Code Online (Sandbox Code Playgroud)
消息查看
Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComGithubClansFab162Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJavaWithJavac
Note: .....YouTubeRecyclerViewFragment.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: ....GetPlaylistAsyncTask.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:proguardRelease UP-TO-DATE
:app:dexRelease
:app:shrinkReleaseResources
Removed unused resources: Binary resource data reduced from 741KB to 402KB: Removed 45%
Note: If necessary, you can disable resource shrinking by adding
android {
buildTypes {
release {
shrinkResources false
}
}
}
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of ....\app\build\intermediates\classes-proguard\release\classes.jar
Information:BUILD FAILED
Information:Total time: 7.45 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)
Int*_*iya 10
你来了
Removed unused resources: Binary resource data reduced from 741KB to 402KB: Removed 45%
Note: If necessary, you can disable resource shrinking by adding
android {
buildTypes {
release {
shrinkResources false
}
}
}
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
Run Code Online (Sandbox Code Playgroud)
资源缩减仅适用于代码收缩.
minifyEnabled是一个Android工具,可以在构建它时减小应用程序的大小.
android {
buildTypes {
release {
shrinkResources true // This must be first
minifyEnabled true // This must be after shrinkResources
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果您还没有使用minifyEnabled构建应用程序来进行代码收缩,那么在启用shrinkResources之前尝试一下,因为您可能需要编辑proguard-rules.pro文件以保留在开始删除之前动态创建或调用的类或方法资源.
请阅读关于收缩您的代码和资源的官方指南
忠告
使用最新版本
compileSdkVersion 25
buildToolsVersion '25.0.1'
targetSdkVersion 25
compile 'com.android.support:appcompat-v7:25.1.0' // set other 25.1.0
Run Code Online (Sandbox Code Playgroud)
注意
YouTubeRecyclerViewFragment.java uses or overrides a deprecated API.
Run Code Online (Sandbox Code Playgroud)
使用备用最新版本.
这:app:proguardRelease UP-TO-DATE..使得这个日志不够完整,无法说明这个答案是否有帮助。
请再次执行 clean + build release 以获取所有步骤的完整日志,您可能还想添加--info到 gradle 选项,甚至--debug在 gradle 构建日志中获取更多诊断消息。
Clean+build 还可能修复一些奇怪的问题,即 gradle/other-tool 无法正确更新某些文件并重用旧的错误文件 - 很少发生。
还尝试关闭缩小(不是解决方案,只是实验),是否有帮助(定位问题实际上是通过 proguard 缩小而不是在其他地方)。
当然,如果在缩小过程中出现与 proguard 相关的错误,请尝试遵循链接答案中的建议。
| 归档时间: |
|
| 查看次数: |
46384 次 |
| 最近记录: |