apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Help, the drawable picture in my release apk package is always renamed, that picture I do not want it to be renamed, what should I do #1655

Closed ChinaGc closed 8 months ago

ChinaGc commented 8 months ago

Bug Report

Problem

What is expected to happen?

Image resources do not want to be renamed

What does actually happen?

has renamed

Information

Command or Code

Environment, Platform, Device

Version information

Checklist

ChinaGc commented 8 months ago

like this DF2C3315-17D7-4812-A650-CDCD2D6A507E

breautek commented 8 months ago

Are you using any obsfucation plugins like proguard?

If so, it would do stuff like this

ChinaGc commented 8 months ago

Are you using any obsfucation plugins like proguard?

If so, it would do stuff like this

Hi,Thank you for your reply, this is a newly created project, without any configuration, and without adding any plugins. 微信截图_20230831133128

faugusztin commented 8 months ago

This is caused by Android Gradle Plugin 4.2 defaulting to android.enableResourceOptimizations=true (which will be the only option in future) - source.

On other side, you are supposed to read these files using corresponding resource identifier in Android code using corresponding API call. Alternatively files you want to read in a Cordova application outside a Cordova plugin should be inside the assets folder or ideally within Cordova www folder, which gets copied to assets/www in final APK file.

breautek commented 8 months ago

@faugusztin

Good find.

Starting in Gradle 8 it will be forcefully enabled as shown in their source.

Gradle 8 will be used in our next major so I don't see any point in adding any kind of feature to change this.

Alternatively files you want to read in a Cordova application outside a Cordova plugin should be inside the assets folder or ideally within Cordova www folder, which gets copied to assets/www in final APK file.

Also true

Closing as won't fix.