Android Gradle Plugin -- Auto Check big image and compress image in building.

Overview

McImage

Gitter

I will continue to update, please rest assured to use

中文文档

Android优雅的打包时自动化获取全部res资源

McImage is a Non-invasive plugin for compress all res in your project.

Include

  • The img in Jar
  • The img in AAR
  • The img in Module

Used algorithm

Release Success!

The version 1.0.1 now support all build.gradle version! Already support mavenCentral.

Feature

  • Compress all png and jpg, every img can save %70 size.
  • As far as possible to convert img to webp (after v0.0.3 support)
  • Auto match the system which you build your project.Include Linux,Mac OS X and Windows (after v0.0.4 support)
  • Use this plugin only need one line code.

Update Log

The user use v0.0.2 update plugin need update your mctools dir together.

  • 1.5.1 : Fix windows support
  • 1.5.0 : Update gradle plugin to 3.5.0 , change the get android resources way,fix not support abbreviation(such as assembleDebug use aD) bug.
  • 1.4.0 : Feature, Support for selecting different optimization types,"ConvertWebp" or "Compress" can be chosen.Default "Compress". "CompressWebp" is a better compression ratio but it don't support api < 18
  • 1.3.0 : Feature, Support multi-thread processing
  • 1.2.0 : Feature, get compress command from system environment prior to local file
  • 1.0.1 : Bug fix, fix maxSize float error
  • 1.0.0 : Support AAPT2 , now don't need to close aapt2 with "android.enableAapt2=false", you can delete this line in gradle.properties.
  • 0.1.4 : Bug fix, add the white list feature, add the img width and height check feature.
  • 0.1.2 : Bug fix(Fix the problem that check image size not work)
  • 0.1.1 : Bug fix(Fix the problem not work for module and fix the problem of enableWhenDebug not work)
  • 0.0.4 : Add auto choose system future.Remove webpQuality config (Set inappropriate will result the img lossless)
  • 0.0.3 : Add webp ! It will auto convert your png (without alpha in min API < 18 and not work in min API < 14) and jpg to webp if it will become more small.
  • 0.0.2 : Improve the log.

Who is using

I can put your icon with one link at here if you use McImage. My email [email protected]

Use

The first, add the plugin in your project root build.gradle.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.smallsoho.mobcase:McImage:1.5.1'
    }
}

Then, apply the plugin in your every module.PS: If you have one more Module, you need apply it in every one.

apply plugin: 'McImage'

Last, put the mctools dir in your project root dir.Download it here

mctools

Config

You can set the config in build.gradle.If you not set this,all config will use default.

=18 or do some compatible measures multiThread true //Whether open multi-thread processing,default true bigImageWhiteList = [] //do not detect big size or large pixels for the images who in the list } ">
McImageConfig {
    isCheckSize true //Whether to detect image size,default true
    optimizeType "Compress" //Optimize Type,"ConvertWebp" or "Compress",default "Compress", "CompressWebp" is a better compression ratio but it don't support api < 18
    maxSize 1*1024*1024 //big image size threshold,default 1MB
    enableWhenDebug false //switch in debug build,default true
    isCheckPixels true // Whether to detect image pixels of width and height,default true
    maxWidth 1000 //default 1000
    maxHeight 1000 //default 1000
    whiteList = [ //do not do any optimization for the images who in the list 
              "icon_launcher.png"
    ]
    mctoolsDir "$rootDir"
    isSupportAlphaWebp false  //Whether support convert the Image with Alpha chanel to Webp,default false, the images with alpha chanels will be compressed.if config true, its need api level >=18 or do some compatible measures 
    multiThread true  //Whether open multi-thread processing,default true
    bigImageWhiteList = [] //do not detect big size or large pixels for the images who in the list
}

Thanks

pngquant

guetzli

cwebp

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • png转换成webp后,子模块的mergeReleaseResources任务报错:java.nio.file.NoSuchFileException。

    png转换成webp后,子模块的mergeReleaseResources任务报错:java.nio.file.NoSuchFileException。

    • 请教个问题: 子模块的mergeReleaseResources任务报错:java.nio.file.NoSuchFileException。因为子模块要找的图片,已经由原来的.png后缀转换成.webp,所以找不到。 大致报错如: Caused by: java.nio.file.NoSuchFileException: .../build/intermediates/packaged_res/release/drawable-hdpi-v4/A.png at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:548) at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:254) at java.base/java.nio.file.Files.copy(Files.java:1294) at com.android.utils.FileUtils.copyFile(FileUtils.java:151) at com.android.utils.FileUtils.copyFile(FileUtils.java:133) at com.android.utils.FileUtils.copyFile(FileUtils.java:116) at com.android.ide.common.resources.CopyToOutputDirectoryResourceCompilationService.submitCompile(CopyToOutputDirectoryResourceCompilationService.kt:27) at com.android.ide.common.resources.MergedResourceWriter.end(MergedResourceWriter.java:292)

    • 出现场景: android studio上没有问题,jenkins上偶尔会出现上述情况。

    • 尝试: 1)因为偶尔出现GC Overhead Limit Exceeded,所以把MaxMetaspaceSize调大,但貌似没有用。 2)猜测可能是多线程导致的,multiThread设置成false,仍会有问题。

    opened by opLW 6
  • Cannot change dependencies of configuration ‘XXX’ after it has been included in dependency resolution.

    Cannot change dependencies of configuration ‘XXX’ after it has been included in dependency resolution.

    错误截图提示如下: image

    image

    看上去是插件内调用getDependencies出现异常,希望作者帮忙看看。(工程不引入mcImage模块时可以正常编译)


    Cannot change dependencies of configuration ':platform_service:common_widget:debugApi' after it has been included in dependency resolution.


    Caused by: org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':platform_service:social_lib:mergeDebugResources'. at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:66) at org.gradle.api.internal.tasks.AbstractTaskDependency.getDependencies(AbstractTaskDependency.java:42) at com.smallsoho.mcplugin.image.ImagePlugin$apply$1$1.execute(ImagePlugin.kt:115) at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:158) at com.smallsoho.mcplugin.image.ImagePlugin$apply$1.execute(ImagePlugin.kt:61) at com.smallsoho.mcplugin.image.ImagePlugin$apply$1.execute(ImagePlugin.kt:16)

    opened by hitYOUcry 5
  • 写了个最简单的demo

    写了个最简单的demo

    写了个最简单的demo,然后把plugin加进去,然后拷了几十张图片进去drawable-xxhdpi,然后跑起来,到mergeDebugResource这一步报错,很多张图片Duplicate resources,到目录下看,在drawable-xxhdpi有重复名字的,但是格式不同的,所以我们这个插件是生成在原有目录下的?要我们手工去删除原来的图片? 看源码好像是有比较大小删除,但是没有成功?

    McImageConfig { isCheckSize false //是否检测图片大小,默认为true optimizeType "ConvertWebp" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好 isSupportAlphaWebp true whiteList = [ "ic_launcher.png", "ic_launcher_round.png", ] maxWidth 5000 //default 1000 maxHeight 5000 //default 1000 }

    opened by wangrunxiang 5
  • 编译错误

    编译错误

    Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with type class com.android.build.gradle.AppPlugin has not been used. at org.gradle.api.internal.plugins.DefaultPluginContainer.getPlugin(DefaultPluginContainer.java:119) at org.gradle.api.plugins.PluginContainer$getPlugin$0.call(Unknown Source) at com.smallsoho.mcplugin.image.utils.AndroidUtil.getAndroidExtension(AndroidUtil.groovy:10) at com.smallsoho.mcplugin.image.utils.AndroidUtil$getAndroidExtension$0.callStatic(Unknown Source) at com.smallsoho.mcplugin.image.utils.AndroidUtil.getMinSdkVersion(AndroidUtil.groovy:16) at com.smallsoho.mcplugin.image.utils.AndroidUtil$getMinSdkVersion.call(Unknown Source) at com.smallsoho.mcplugin.image.webp.WebpUtils.isPNGConvertSupported(WebpUtils.groovy:17) at com.smallsoho.mcplugin.image.webp.WebpUtils$isPNGConvertSupported$0.callStatic(Unknown Source) at com.smallsoho.mcplugin.image.webp.WebpUtils.securityFormatWebp(WebpUtils.groovy:52) at com.smallsoho.mcplugin.image.webp.WebpUtils$securityFormatWebp.call(Unknown Source) at com.smallsoho.mcplugin.image.ImagePlugin$_apply_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7.doCall(ImagePlugin.groovy:99) at com.smallsoho.mcplugin.image.ImagePlugin$_apply_closure1$_closure2$_closure3$_closure4$_closure5$_closure6.doCall(ImagePlugin.groovy:90) at com.smallsoho.mcplugin.image.ImagePlugin$_apply_closure1$_closure2$_closure3$_closure4$_closure5.doCall(ImagePlugin.groovy:87) at com.smallsoho.mcplugin.image.ImagePlugin$_apply_closure1$_closure2$_closure3$_closure4.doCall(ImagePlugin.groovy:86) at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:656) at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:637) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:115) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:109) at org.gradle.internal.Transformers$4.transform(Transformers.java:169) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:109) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:90) ... 20 more

    opened by qianzui 4
  • isCheckPixels 导致IIOException

    isCheckPixels 导致IIOException

    Windows上使用as,在编译release包的时候出现Execution failed for task ':app:McImageHyRelease'.

    javax.imageio.IIOException: Caught exception during read:

    配置如下: McImageConfig { isCheckSize false //是否检测图片大小,默认为true optimizeType "Compress" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好 maxSize 310241024 //大图片阈值,default 1MB enableWhenDebug false //debug下是否可用,default true isCheckPixels true// 是否检测大像素图片,default true maxWidth 2000 //default 1000 如果开启图片宽高检查,默认的最大宽度 maxHeight 2000 //default 1000 如果开启图片宽高检查,默认的最大高度 whiteList = [ //默认为空,如果添加,对图片不进行任何处理 "icon_launcher.png" ] mctoolsDir "$rootDir" isSupportAlphaWebp false //是否支持带有透明度的webp,default false,带有透明图的图片会进行压缩 multiThread false //是否开启多线程处理图片,default true bigImageWhiteList = ["exo_ic_default_album_image.png"] //默认为空,如果添加,大图检测将跳过这些图片 }

    isCheckPixels true改成isCheckPixels false之后就可以了,不涉及到安全路径,不明白为什么

    opened by wisdomcai 3
  • apply plugin存在报错

    apply plugin存在报错

    A problem occurred configuring project ':home'. Could not determine the dependencies of task ':home:mergeDebugResources'. Could not resolve all dependencies for configuration ':home:debugRuntimeClasspath'. > A problem occurred configuring project ':home-api'. > Circular referencing during evaluation for project ':home'.

    问一下大佬有可能是啥原因?

    opened by wangrunxiang 3
  • config them into bigImageWhiteList to fix this Exception!!!

    config them into bigImageWhiteList to fix this Exception!!!

    这些大图片也需要做压宿、如果都加到bigImageWhiteList里面,是否就跳过不压缩这些图片了? 要如何处理呢? 谢谢 You have big Imgages with big size or large pixels,please confirm whether they are necessary or whether they can to be compressed. If so, you can config them into bigImageWhiteList to fix this Exception!!! /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/3ef5721092263fff59a97625e14540bd/jetified-facebook-login-5.15.3/res/drawable-mdpi-v4/com_facebook_profile_picture_blank_portrait.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/3ef5721092263fff59a97625e14540bd/jetified-facebook-login-5.15.3/res/drawable-mdpi-v4/com_facebook_profile_picture_blank_square.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/e6eabd2f19b43a5b354321aca5181adc/jetified-facebook-common-5.15.3/res/drawable-xxhdpi-v4/com_facebook_close.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/e6eabd2f19b43a5b354321aca5181adc/jetified-facebook-common-5.15.3/res/drawable-xhdpi-v4/com_facebook_close.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/e6eabd2f19b43a5b354321aca5181adc/jetified-facebook-common-5.15.3/res/drawable-mdpi-v4/com_facebook_close.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/e6eabd2f19b43a5b354321aca5181adc/jetified-facebook-common-5.15.3/res/drawable-hdpi-v4/com_facebook_close.png /Users/xuanwenchao/.gradle/caches/transforms-2/files-2.1/a87b407744fc773eacf256800a420224/jetified-pinpad-1.0.4/res/drawable-xxhdpi-v4/ps_backspace.png

    opened by xuanwenchao 2
  • 写了个demo,好像不能处理mipmap下的东西,直接报错跑不起来

    写了个demo,好像不能处理mipmap下的东西,直接报错跑不起来

    Task :app:mergeDebugResources FAILED AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-hdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher.png"}},{"file":{"description":"mipmap-hdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-hdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher_round.png"}},{"file":{"description":"mipmap-hdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher_round.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-mdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher.png"}},{"file":{"description":"mipmap-mdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-mdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher_round.png"}},{"file":{"description":"mipmap-mdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher_round.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.png"}},{"file":{"description":"mipmap-xhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher_round.png"}},{"file":{"description":"mipmap-xhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher_round.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xxhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.png"}},{"file":{"description":"mipmap-xxhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xxhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher_round.png"}},{"file":{"description":"mipmap-xxhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher_round.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xxxhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png"}},{"file":{"description":"mipmap-xxxhdpi-v4/ic_launcher","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.webp"}}],"tool":"Resource and asset merger"} AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"mipmap-xxxhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png"}},{"file":{"description":"mipmap-xxxhdpi-v4/ic_launcher_round","path":"D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.webp"}}],"tool":"Resource and asset merger"}

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    [mipmap-hdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher.png [mipmap-hdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher.webp: Error: Duplicate resources [mipmap-hdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher_round.png [mipmap-hdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-hdpi\ic_launcher_round.webp: Error: Duplicate resources [mipmap-mdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher.png [mipmap-mdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher.webp: Error: Duplicate resources [mipmap-mdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher_round.png [mipmap-mdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-mdpi\ic_launcher_round.webp: Error: Duplicate resources [mipmap-xhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.png [mipmap-xhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.webp: Error: Duplicate resources [mipmap-xhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher_round.png [mipmap-xhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xhdpi\ic_launcher_round.webp: Error: Duplicate resources [mipmap-xxhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.png [mipmap-xxhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.webp: Error: Duplicate resources [mipmap-xxhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher_round.png [mipmap-xxhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher_round.webp: Error: Duplicate resources [mipmap-xxxhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png [mipmap-xxxhdpi-v4/ic_launcher] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.webp: Error: Duplicate resources [mipmap-xxxhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png [mipmap-xxxhdpi-v4/ic_launcher_round] D:\AndroidStudioProjects\McImageDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.webp: Error: Duplicate resources

    opened by wangrunxiang 2
  • 大图已加忽略,依然提醒

    大图已加忽略,依然提醒

    已给您发邮件

    代码中已经添加 McImageConfig { isCheckSize true //是否检测图片大小,默认为true optimizeType "Compress" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好 maxSize 110241024 //大图片阈值,default 1MB enableWhenDebug false //debug下是否可用,default true isCheckPixels true // 是否检测大像素图片,default true maxWidth 1000 //default 1000 如果开启图片宽高检查,默认的最大宽度 maxHeight 1000 //default 1000 如果开启图片宽高检查,默认的最大高度 whiteList = [ //默认为空,如果添加,对图片不进行任何处理 "icon_launcher.png" ] mctoolsDir "$rootDir" isSupportAlphaWebp false //是否支持带有透明度的webp,default false,带有透明图的图片会进行压缩 multiThread true //是否开启多线程处理图片,default true bigImageWhiteList = [ "lib_guide_1.png", "lib_guide_2.png", "lib_guide_3.png", "lib_splash.png" ] //默认为空,如果添加,大图检测将跳过这些图片 }

    依然提醒

    • What went wrong: Execution failed for task ':app:McImageRelease'.

    You have big Imgages with big size or large pixels,please confirm whether they are necessary or whether they can to be compressed. If so, you can config them into bigImageWhiteList to fix this Exception!!! C:\Users\86189\AndroidStudioProjects\Car99\library\build\intermediates\packaged_res\release\mipmap-xhdpi-v4\lib_guide_1.png C:\Users\86189\AndroidStudioProjects\Car99\library\build\intermediates\packaged_res\release\mipmap-xhdpi-v4\lib_guide_2.png C:\Users\86189\AndroidStudioProjects\Car99\library\build\intermediates\packaged_res\release\mipmap-xhdpi-v4\lib_guide_3.png C:\Users\86189\AndroidStudioProjects\Car99\library\build\intermediates\packaged_res\release\mipmap-xhdpi-v4\lib_splash.png

    opened by ai2101039 2
  • sourceImg must not be null 出现了这个问题,无法定位

    sourceImg must not be null 出现了这个问题,无法定位

    Task :app:McImageRelease FAILED ---- McImage Plugin Start ---- <<<<<<<<<<<<<>>>>>>>>>>> maxSize :1048576.0 isCheckSize: true optimizeType: ConvertWebp enableWhenDebug: false isCheckPixels: true maxWidth: 1000, maxHeight: 1000 mctoolsDir: /Users/xxx/Workspace/android/dev/xxx isSupportAlphaWebp: false multiThread: true whiteList : bigImageWhiteList: <<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:McImageRelease'.

    sourceImg must not be null

    opened by i-show 2
  • Gradle 编译报错 Cannot invoke

    Gradle 编译报错 Cannot invoke "java.awt.image.BufferedImage.getHeight()" because "sourceImg" is null

    报错信息无法定位问题

    Execution failed for task ':app:McImageApkpureApkDebug'.

    Cannot invoke "java.awt.image.BufferedImage.getHeight()" because "sourceImg" is null

    opened by xiuyuantech 0
  • 集成报错Cannot cast object 'property(interface org.gradle.api.file.Directory

    集成报错Cannot cast object 'property(interface org.gradle.api.file.Directory

    现有项目gradle:classpath 'com.android.tools.build:gradle:3.2.1' 集成后报错:Cannot cast object 'property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /app/build/intermediates/merged_manifests/debug))' with class 'org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar' to class 'java.io.File' 求指导

    opened by fightKen 0
  • javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xcd

    javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xcd

    哈喽,碰到了个问题,我使用McImage,升级到最新的1.5.1,提示的是跟jpeg图片相关的问题,有点纳闷。配置么,用的就是你给的默认的配置

    isCheckSize true //是否检测图片大小,默认为true optimizeType "Compress" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好 maxSize 110241024 //大图片阈值,default 1MB enableWhenDebug false //debug下是否可用,default true isCheckPixels true // 是否检测大像素图片,default true maxWidth 1000 //default 1000 如果开启图片宽高检查,默认的最大宽度 maxHeight 1000 //default 1000 如果开启图片宽高检查,默认的最大高度 whiteList = [ //默认为空,如果添加,对图片不进行任何处理 ] isSupportAlphaWebp false //是否支持带有透明度的webp,default false,带有透明图的图片会进行压缩 multiThread false //是否开启多线程处理图片,default true bigImageWhiteList = [] //默认为空,如果添加,大图检测将跳过这些图片

    报的错误如下:

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':bdsm:McImageRelease'.

    javax.imageio.IIOException: Unsupported JPEG process: SOF type 0xcd

    • Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bdsm:McImageRelease'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148) at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141) at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108) at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)

    后面改成了如下形式:目前看是没有报错了 // isCheckSize false // optimizeType "Compress" // isCheckPixels false // isSupportAlphaWebp false // enableWhenDebug false // multiThread false // whiteList = [ //do not do any optimization for the images who in the list // "yw_1222_baichuan.jpg", "post.jpg" // ]

    对于这种情况,也有问题,whiteList里面添加的几个jpg图片,如果我不放到白名单里面,我的app就会crash,很奇怪,对于post.jpg, 可以理解为Glide加载的时候的placeHolder占位图,我从反编译的R文件里面,都找不到post这个资源id,很是邪门。。

    对于这两个问题,想听听龙博大佬的分析。

    opened by xingstarx 0
Releases(v1.5.1)
Owner
smallSohoSolo
Android Software Engineer
smallSohoSolo
Gradle plugin to check, if rest-controllers are used by clients and clients have suitable rest-interfaces

Verify-Feign Gradle Plugin This plugin will help you to verify all rest-clients and -controllers in a multimodule spring project. It will check, if al

null 3 May 11, 2022
Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms.

CompleteKotlin Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms. What this plugin provides This zero-conf

Louis CAD 235 Jan 3, 2023
Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects

Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects. Former: kotlin-ir-plugin-adapter-gradle

null 2 Mar 8, 2022
A Gradle plugin that generates plugin.yml for Bukkit/BungeeCord/Nukkit plugins based on the Gradle project

plugin-yml is a simple Gradle plugin that generates the plugin.yml plugin description file for Bukkit plugins, bungee.yml for Bungee plugins or nukkit.yml for Nukkit plugins based on the Gradle project. Various properties are set automatically (e.g. project name, version or description) and additional properties can be added using a simple DSL.

Plexus 0 Apr 10, 2022
Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Dipien 142 Dec 29, 2022
The core Gradle plugin and associated logic used for Slack's Android app

slack-gradle-plugin This repository contains the core Gradle plugin and associated logic used for Slack's Android app. This repo is effectively read-o

Slack 306 Dec 30, 2022
A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes.

Change Tracker Plugin A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes

Ismael Di Vita 110 Dec 19, 2022
Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.

Multiplatform Swift Package This is a Gradle plugin for Kotlin Multiplatform projects that generates an XCFramework for your native Apple targets and

Georg Dresler 262 Jan 5, 2023
Gradle Plugin for publishing artifacts to Sonatype and Nexus

Introduction Due to Sonatype's strict validation rules, the publishing requirement must be satisfied by every artifact which wants to be published to

Johnson Lee 21 Oct 14, 2022
Gradle plugin that parses version updates and assigns them to groups of people.

Notifier Gradle Plugin This gradle plugin serves the need of automating how dependencies are handles in a project. More specifically, it functions usi

Plum 4 Oct 27, 2022
A Gradle plugin enforcing pre-commit and commit-msg Git hooks configuration

A Gradle plugin enforcing pre-commit and commit-msg Git hooks configuration. Conventional-commits-ready.

Danilo Pianini 24 Dec 16, 2022
Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options.

Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options. It does this by creating a static library for kotlin compilation, then generates a c+kotlin wrapper that calls into kotlin to start the app, finally using the specified compiler to compile and link the c code and kotlin library into a binary.

Jason Monk 4 Apr 14, 2022
Kmp4free - A Gradle Plugin that allows seamless switching between Kotlin JVM and the Kotlin Multiplatform Plugins

?? kmp4free Allows you to toggle between Kotlin JVM Plugin -> Kotlin Multiplatform with a Gradle Property kmp4free=true. This Gradle Plugin was built

Sam Edwards 61 Oct 14, 2022
A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically

A simple gradle plugin that lets you create a download asset from zeplin and convert them to vector drawables automatically elephant project using 100% Kotlin and be up and running in a few seconds.

Qifan Yang 21 Sep 21, 2022
A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

Rikka apps 124 Dec 31, 2022
Grazel is a Gradle plugin to automate generation of valid Bazel files for a given Android/Kotlin/Java project.

Grazel Grazel stands for Gradle to Bazel. It is a Gradle plugin that enables you to migrate Android projects to Bazel build system in an incremental a

Grab 228 Jan 2, 2023
A Gradle plugin helps to proxy all the BuildConfig fields in the Android project.

Readme A Gradle plugin helps to proxy all the BuildConfig fields in the Android project. Background In android BuildConfig, We might have different co

Jack Chen 4 Oct 11, 2021
Gradle plugin for running Android tests with emulator.wtf

emulator.wtf Gradle Plugin Emulator.wtf is an Android cloud emulator laser-focused on performance to deliver quick feedback to your PRs. With this Gra

emulator.wtf 3 May 15, 2022
A Gradle Plugin for Android BundleTool.

A Gradle Plugin for Android BundleTool.

El 38 Jan 6, 2023