shwenzhang / AndResGuard

proguard resource for Android by wechat team
Apache License 2.0
8.55k stars 1.54k forks source link

安卓studio 4.2.0打包问题 #467

Open hyhyhykw opened 3 years ago

hyhyhykw commented 3 years ago

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

hyhyhykw commented 3 years ago

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

liyujiang-gzu commented 3 years ago

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

hyhyhykw commented 3 years ago

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

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

wutongke commented 3 years ago

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

zhaiyong4118 commented 3 years ago

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

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

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

hyhyhykw commented 3 years ago

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

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

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

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

jasonvzhao commented 3 years ago

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

zjcoming commented 4 months ago

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