Can not re-sign Android system app without app crashing (using LineageOS) - android

I have re-signed all system apps of LineageOS with my own key and have replaced them all before the first boot. LineageOS boots normally but then all re-signed system apps crash with an error like:
SystemUI stopped, Settings stopped.
It seems that the re-signed system apps are unusable. Maybe I made some mistake or LineageOS has some anti-tampering check implemented?
What i have done:
I opened all system apps with the winrar zip manager and removed the CERT.RSA and CERT.SF files in each META INF folder and deleted all the names and SHA-256 digest entries in all MF manifest-files. Also all other apk for example, in the framework folder, like the framework-res.apk file, I edited them like this. Then I created a keystore with Key, using the Java keytool, I think this is self-signed. Then I signed all APKs with the Uber Apk signet tool and successfully performed zip-aligning. Then I flashed Lineage OS with TWRP on the phone. Before the first boot, I deleted the system apks with the TWRP file manager and replaced them with my self-signed ones.
Uber-Sign-Tool: https://github.com/patrickfav/uber-apk-signer
Picture of the error: https://imgur.com/a/hAwsJuO
Thanks for your help
Mike the android-noob

Related

Modify signed .apk file for Android

For some time I've been generating signed .apk files in Android Studio and then I was sending generated .apks to other people. Usually they were changing certificates of the apps.
Right now they can't do it, because every time I generate an apk in Android Studio it's locked for modifications and acts like read-only file. Is there a way to somehow disable that restriction in Android Studio or Gradle settings?
In Windows CMD the only attrib of generated and signed .apk file is an 'A'.

Android Signature key differences between Old and New PC

An existing package by the same name with a conflicting signature is already installed
I had developed an inhouse app years back on an old PC and had deployed it. Now I got a new PC, that I used to work on some upgrades, but when I tried to upgrade the app on android devices, I got the above error message.
If I uninstall the old version, I am able to install the upgrade. But unfortunately I won't be able to uninstall and reinstall on remote devices.
I think that if I copy the upgrades back to the old PC and regenerate an APK, that might work, but is there any way I can copy the signature keys from the old PC to the new one and make the installation work?
It will help
The automatically generated key is called the debug key/certificate.
You should generate a new key can just copy it over to both your devices. The only negative of this is your builds process is longer as you need a manual steps.
The other option is to copy over the debug key from one of the systems.
You will find the keys in a folder names .android in your home directory in Linux & user directory in Windows
Tip: Never loose the certificate once you push an app to the market.
In Unix like os the debug key is located by default in ~/.android/debug.keystore

Error while Installing .apk file through adb

I am trying to install an apk file on my Android device using ADB with the following command:
E:\adt-bundle-windows-x86-20131030\sdk\platform-tools>adb install -r WebserviceA
ctivity.apk
But I get this error message:
158 KB/s (225399 bytes in 1.391s)
pkg: /data/local/tmp/WebserviceActivity.apk
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
Before put your question in stackoverflow just do some googling i'm sure you get something very useful.
Anyways,
try like this
uninstall the existing .apk
and then
re-install the new .apk
Googling your error message can be very succesfull:
It means the new copy of your application (on your development
machine) was signed with a different signing key than the old copy of
your application (installed on the device/emulator). For example, if
this is a device, you might have put the old copy on from a different
development machine (e.g., some other developer's machine). Or, the
old one is signed with your production key and the new one is signed
with your debug key.
https://stackoverflow.com/a/3185824/1683141
So you need to make sure your application is signed with same key as the currently installed application. Note that a debug key is different from a regular key.
If you do not have your old signing key anymore, then you should remove your old application first.

Apk file Generation -Issue

I have created a signed .apk file and I've followed all of the steps (Created Keystore,Password and validity yrs,etc...) and I have an .apk file.
When I install this to any mobile device, it shows the installation failed, so I checked the apk file.
It contains only
META-INF Folder
classes.dex.
I'm unable to find the other files. This is the first time I'm facing this issue.
Does anyone know what may cause this?
Installing a production release over a debug release and vice versa will cause a failed installation.
Uninstall the current version first.
Keystore signed versions can be installed on top of each other.
Debug signed versions can be installed on top of each other.
Debug and Keystore versions cannot be installed on top of each other.
i solved the issue.....some privilege issue...if i do the same thing as a super user in the same system everything works fine(Generated APK).
Thanks friends

Testing on Real device

If i use the .apk file that is in the bin directory in the project in the workspace instead of generating the .apk by exporting the project does it make difference?
The apk file in the bin is signed using the debug key, which loses the benefit of signing your App. Your App should be signed using your own key (which is specified when you export the project) which kind of uniquely identify your Apps and protects (or tries to protect) your Apps from having someone alter your App and republish it. Also, when you upload an update for your App, it must be signed with the same key as the original App, so make sure to keep this key safe.
You can use the apk from the bin folder while debugging, but when publishing the app, you must export a signed apk, or sign the one from the bin folder manually.
However, an easier method would be to directly debug on a hardware device from eclipse, as this gives you access to various tools like the adb and LogCat, See this link for details.

Categories

Resources