2015-10-21 3 views
1

При использовании proguard с minifyEnabled true я получаю предупреждение во время сборки assreRelease, и мое приложение не загружает большинство изображений, которые я использую для скольжения для загрузки.Ошибка с proguard, glide 3.6.1 и gradle 1.3.1

В отладочной версии, и если я устанавливаю minifyEnabled false, все работает нормально. Не могли бы вы помочь?

build.gradle

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.1" 
useLibrary 'org.apache.http.legacy' 

defaultConfig { 
    applicationId "com.xxxxxx" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 17 
    versionName "1.20151021" 
} 

allprojects { 
    tasks.withType(JavaCompile) { 
     options.compilerArgs << "-Xlint:deprecation" 
    } 
} 
android.applicationVariants.all { variant -> 
    def appName 
    //Check if an applicationName property is supplied; if not use the name of the parent project. 
    if (project.hasProperty("applicationName")) { 
     appName = applicationName 
    } else { 
     appName = parent.name 
    } 

    variant.outputs.each { output -> 
     def newApkName 
     //If there's no ZipAlign task it means that our artifact will be unaligned and we need to mark it as such. 
     if (output.zipAlign) { 
      newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk" 
     } else { 
      newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk" 
     } 
     output.outputFile = new File(output.outputFile.parent, newApkName) 
    } 
} 

signingConfigs { 
    free { 
     storeFile file('xxxxxx') 
     storePassword "$System.env.KEYSTORE_PASSWORD" 
     keyAlias "xxxxx" 
     keyPassword "$System.env.KEYSTORE_PASSWORD" 
    } 
    pro { 
     storeFile file('xxxx') 
     storePassword "$System.env.KEYSTORE_PASSWORD" 
     keyAlias "xxxxxx" 
     keyPassword "$System.env.KEYSTORE_PASSWORD" 
    } 
} 
buildTypes { 
    release { 
     // signingConfig signingConfigs.release 
     minifyEnabled true 
     shrinkResources true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

productFlavors { 
    free { 
     applicationId "com.xxxxxx" 
     buildConfigField 'Boolean', 'IS_APP_PRO', 'false' 
     signingConfig signingConfigs.free 
    } 
    pro { 
     applicationId "com.xxxxxxx" 
     buildConfigField 'Boolean', 'IS_APP_PRO', 'true' 
     signingConfig signingConfigs.pro 
    } 
} 
} 
dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:appcompat-v7:23.0.1' 
compile 'com.android.support:recyclerview-v7:23.0.1' 
compile 'com.android.support:cardview-v7:23.0.1' 
compile 'com.google.android.gms:play-services-ads:8.1.0' 
compile 'com.github.bumptech.glide:glide:3.6.1' 
compile 'com.android.support:support-v4:23.0.1' 
} 

proguard-rules.pro

-keep public class * implements com.bumptech.glide.module.GlideModule 
-keep public enum   com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { 
    **[] $VALUES; 
    public *; 
} 

предупреждения во время assembleRelease:

Executing tasks: [assembleRelease] 

Configuration on demand is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preFreeReleaseBuild UP-TO-DATE 
:app:checkFreeReleaseManifest 
:app:preFreeDebugBuild UP-TO-DATE 
:app:preProDebugBuild UP-TO-DATE 
:app:preProReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE 
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE 
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE 
:app:prepareFreeReleaseDependencies 
:app:compileFreeReleaseAidl UP-TO-DATE 
:app:compileFreeReleaseRenderscript UP-TO-DATE 
:app:generateFreeReleaseBuildConfig UP-TO-DATE 
:app:generateFreeReleaseAssets UP-TO-DATE 
:app:mergeFreeReleaseAssets UP-TO-DATE 
:app:generateFreeReleaseResValues UP-TO-DATE 
:app:generateFreeReleaseResources UP-TO-DATE 
:app:mergeFreeReleaseResources UP-TO-DATE 
:app:processFreeReleaseManifest UP-TO-DATE 
:app:processFreeReleaseResources 
:app:generateFreeReleaseSources 
:app:processFreeReleaseJavaRes UP-TO-DATE 
:app:compileFreeReleaseJavaWithJavac UP-TO-DATE 
:app:compileFreeReleaseNdk UP-TO-DATE 
:app:compileFreeReleaseSources UP-TO-DATE 
:app:lintVitalFreeRelease 
Unexpected failure during lint analysis of ArticlesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of CategoriesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of ArticleDetailActivity.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of SplashActivity.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 

:app:proguardFreeRelease 
Note: there were 7 duplicate class definitions. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass) 
:app:dexFreeRelease 
:app:shrinkFreeReleaseResources 
Removed unused resources: Binary resource data reduced from 16682KB to 3190KB: Removed 80% 
Note: If necessary, you can disable resource shrinking by adding 
android { 
    buildTypes { 
     release { 
      shrinkResources false 
     } 
    } 
} 
:app:validateFreeSigning 
:app:packageFreeRelease 
:app:zipalignFreeRelease 
:app:assembleFreeRelease 
:app:checkProReleaseManifest 
:app:prepareProReleaseDependencies 
:app:compileProReleaseAidl UP-TO-DATE 
:app:compileProReleaseRenderscript UP-TO-DATE 
:app:generateProReleaseBuildConfig UP-TO-DATE 
:app:generateProReleaseAssets UP-TO-DATE 
:app:mergeProReleaseAssets UP-TO-DATE 
:app:generateProReleaseResValues UP-TO-DATE 
:app:generateProReleaseResources UP-TO-DATE 
:app:mergeProReleaseResources UP-TO-DATE 
:app:processProReleaseManifest UP-TO-DATE 
:app:processProReleaseResources UP-TO-DATE 
:app:generateProReleaseSources UP-TO-DATE 
:app:processProReleaseJavaRes UP-TO-DATE 
:app:compileProReleaseJavaWithJavac UP-TO-DATE 
:app:compileProReleaseNdk UP-TO-DATE 
:app:compileProReleaseSources UP-TO-DATE 
:app:lintVitalProRelease 
Unexpected failure during lint analysis of ArticlesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of CategoriesRecyclerViewAdapter.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of ArticleDetailActivity.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 
Unexpected failure during lint analysis of SplashActivity.java (this is a bug in lint or one of the libraries it depends on) 
TypeSystem.getUnannotatedType(TypeSystem.java:180)->TypeSystem.getParameterizedType(TypeSystem.java:238)->TypeSystem.getParameterizedType(TypeSystem.java:261)->LookupEnvironment.createParameterizedType(LookupEnvironment.java:949) 

:app:proguardProRelease 
Note: there were 7 duplicate class definitions. 
     (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass) 
:app:dexProRelease 
:app:shrinkProReleaseResources 
Removed unused resources: Binary resource data reduced from 16682KB to 3190KB: Removed 80% 
:app:validateProSigning 
:app:packageProRelease 
:app:zipalignProRelease 
:app:assembleProRelease 
:app:assembleRelease 

BUILD SUCCESSFUL 

Total time: 29.188 secs 

ответ

0

Найдена проблема. Проблема заключалась в том, что мои изображения находились в папке с возможностью переноса, и shrinkResources удалял их, потому что я не использовал их в коде. Я отключил shrinkResources и понизился до уровня 1.3.0, и теперь все работает нормально.

+0

Используйте это, чтобы сохранить свои ресурсы: http://tools.android.com/tech-docs/new-build-system/resource-shrinking –

 Смежные вопросы

  • Нет связанных вопросов^_^