user577732
user577732

Reputation: 4056

Update a file inside an apk with java

Okay i have an android apk lets say app1.apk and it's located at /system/app

app1.apk has an outdated xml lets say file.xml located within the apk at res/drawable

A new updated file.xml is located at /data/misc/file.xml on the phone

I want to have the updated file.xml located on the phone be switched into the apk and replace the old one how can i go about doing this in java?

Thank you for any help it is greatly appreciated

It would be for only rooted devices by the way but i'm going to copy the apk out of the system as well

Upvotes: 0

Views: 583

Answers (1)

Jason LeBrun
Jason LeBrun

Reputation: 13293

On a typical Android device, the .apk files for an app are stored with write permissions only for those in the system group. So unless you are running on a rooted device that can change those permissions, it's not possible to modify these APKs.

If you need to update resources, your best bet is to download them into the external storage space on the phone, and check for a version of the file on the SD card before defaulting to the version in the APK.

Upvotes: 1

Related Questions