Reputation: 4256
Lets say we have downloaded, built and flashed AOSP source code. Now a change to a system app is made (e.g. changed a constant in the packages/apps/Nfc package).
The next step is to build it, and there are two ways to do it:
cd packages/apps/Nfc; mm
or
mmm Nfc
This will create out/target/product//system/app/NfcNci/NfcNci.apk file
Which is the proper way to update the system app?
I tried using adb install NfcNci.apk but no success:
~/android/aosp-7.1.2-3.10-v2/out/target/product/kugo/system/app/NfcNci$ adb install NfcNci.apk
Failed to install NfcNci.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install com.android.nfcnci without first uninstalling.]
~/android/aosp-7.1.2-3.10-v2/out/target/product/kugo/system/app/NfcNci$ adb install -r NfcNci.apk
Failed to install NfcNci.apk: Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/com.android.nfcnci-1: Package /data/app/com.android.nfcnci-1/base.apk code is missing]
Upvotes: 3
Views: 5186
Reputation: 4256
Found a way to easily 're-install' the app itself (let's put Settings app as an example):
mmm packages/apps/Settings # Build the module
adb root ; adb remount # Restart adbd as root and mount /system as writable
adb push out/target/product/<device_name>/system/priv-app/Settings /system/priv-app # Push the built files to the device
Then force-close and restart the app (by swiping it from Recents). No need to reboot device in order to take changes
NOTE: Depending on the app, the path may be on system/app
instead of /system/priv-app
Upvotes: 5
Reputation: 4088
Another way is to:
adb push
mount -o rw,remount,rw /system
For development you can use a simple script for this steps.
Upvotes: 1
Reputation: 4178
Check build/envsetup.sh file - there's also commands mmp
and mmmp
to build and push a module to connected device. Also adb sync
can be used to sync whole image, so if you updated a module, changed files will be pushed to device.
Also you can put the changed files via regular `adb push' and reboot device.
I do not know if system apps can be updated via adb install
, probably yes, but I think you need to increment build number in the manifest file.
I do not think you can uninstall a system app with adb install -r
, as apps can't be removed from system
partition, only from data
. I do not know why you are getting INSTALL_FAILED_INVALID_APK in that case, may be because app manager can't uninstall the base system apk indeed.
Upvotes: 0