AndResGuard icon indicating copy to clipboard operation
AndResGuard copied to clipboard

安卓studio 4.2.0打包问题

Open hyhyhykw opened this issue 3 years ago • 8 comments

Android studio 最新版4.2.0打包时也会把部分资源混淆一遍,但是对应的名称没改,而且区分了大小写,大概是这样 image ,在windows上直接解压会导致很多资源文件被覆盖,出现问题。想问一下有没有适配的计划

hyhyhykw avatar May 07 '21 11:05 hyhyhykw

还有,打包时还会将除了color之外的资源全部放到res根目录中

hyhyhykw avatar May 07 '21 12:05 hyhyhykw

我就说呢,升级到Android Studio 4.2后打包后,好多图片资源全不见了,安装包安装后打不开

liyujiang-gzu avatar May 12 '21 07:05 liyujiang-gzu

我就说呢,升级到Android Studio 4.2后打包后,好多图片资源全不见了,安装包安装后打不开

我自己修改了一个 https://github.com/hyhyhykw/AndResGuardJar

hyhyhykw avatar May 12 '21 07:05 hyhyhykw

Addandroid.enableResourceOptimizations=falsein gradle.properties can disable ResourceOptimizations, then you can use AndResGurad.

wutongke avatar May 29 '21 01:05 wutongke

我就说呢,升级到Android Studio 4.2后打包后,好多图片资源全不见了,安装包安装后打不开

我自己修改了一个 https://github.com/hyhyhykw/AndResGuardJar

修改了什么呢,可以说明一下吗

zhaiyong4118 avatar Jun 29 '21 04:06 zhaiyong4118

我就说呢,升级到Android Studio 4.2后打包后,好多图片资源全不见了,安装包安装后打不开

我自己修改了一个 https://github.com/hyhyhykw/AndResGuardJar

修改了什么呢,可以说明一下吗

就是修改了图片资源名称重复会覆盖的问题

hyhyhykw avatar Jun 29 '21 12:06 hyhyhykw

try classpath "com.android.tools.build:gradle:4.1.1"

jasonvzhao avatar Sep 24 '21 13:09 jasonvzhao

AGP4.2之后aapt2打包会默认开启资源缩短优化,但是混淆后的资源是区分大小写的,但是MAC和Linux机器文件名是不区分大小写的,这时候开启AndResGuard优化会拷贝到temp的时候会导致AA.xml覆盖aa.xml的问题,最终导致打到包内的资源文件变少,题主的改法虽然能解决资源缺少的问题,但是AndResGuard的重复资源删除功能却用不了了,导致APK中res文件变大。 After AGP4.2, aapt2 packaging will enable resource shortening optimization by default, but the obfuscated resources are case-sensitive, but MAC and Linux machine file names are not case-sensitive. At this time, when AndResGuard optimization is turned on, it will be copied to temp. The problem caused AA.xml to overwrite aa.xml, which ultimately resulted in fewer resource files being included in the package. Although the subject's modification method can solve the problem of lack of resources, the duplicate resource deletion function of AndResGuard cannot be used, resulting in APK res file becomes larger

zjcoming avatar Jul 24 '24 09:07 zjcoming