Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sign Android app with system signature?

Tags:

android

I've downloaded and compiled Android 2.1 version with signed-google_ion-ota-14721.zip image for my HTC phone. The compile completed successfully and so the system image flash. How can I sign my own Android application with the system signature?

Can someone describe the whole process for signing a user application with system signature as I am completely new to the signing process.

like image 371
Michalis Avatar asked Sep 03 '10 11:09

Michalis


People also ask

How do I add signature to Android app?

You need to set SignatureMainLayout as the primary content view in your mainactivity. java file. For adding the button and the signature view you need to add the given code in SignatureMainLayout. java file which contains two classes which returns user interface.

How do you sign an app as a system app?

You can only sign your application like a system app if you are building Android from source for your project. The AOSP signing keys are blocked in play store, FWIK. So if you sign your app with that key it won't publish on play store.

How Android apps are signed?

Android requires that all apps be digitally signed with a certificate before they can be installed. Android uses this certificate to identify the author of an app, and the certificate does not need to be signed by a certificate authority. Android apps often use self-signed certificates.

Do Android apps require signing?

Every application that is run on the Android platform must be signed by the developer. Applications that attempt to install without being signed will be rejected by either Google Play or the package installer on the Android device.


1 Answers

Finally I managed to discover a way to sign my application with the platform signature. You need to use keys located in <root-of-android-source-tree>/build/target/product/security/ and add android:sharedUserId="android.uid.system" in your AndroidManifest.xml file.

Details from this google groups thread:

On top of signing Android 1.6 for Dream with certificates generated by myself, I've also managed to sign my app with the platform certificate and run it with the system sharedUserId. These are the steps I took:

  • Build and flash to your Dream your own Android using https://web.archive.org/web/20081211205758/http://source.android.com:80/documentation/building-for-dream. Use the mkkey.sh script on https://web.archive.org/web/20091213215940/http://pdk.android.com/online-pdk/guide/release_keys.html to create new certificates, including x509 certificates before you do 'make'.
  • In the AndroidManifest.xml of your application: under the <manifest> element, add the attribute android:sharedUserId="android.uid.system".
  • Export an unsigned version of your Android application using Eclipse: right-click on the project >> Android Tools >> Export Unsigned Application Package.
  • Use <root-of-android-source-tree>/out/host/<your-host>/framework/signapk.jar to sign your app using platform.x509.pem and platform.pk8 in <root-of-android-source-tree>/build/target/product/security generated earlier:

    java -jar signapk.jar platform.x509.pem platform.pk8 YourApp-unsigned.apk YourApp-signed.apk. 
  • Install the app to your device:

    adb install YourApp-signed.apk 
  • Run your app
  • Use adb shell ps to confirm that your app is running as system.
like image 156
Michalis Avatar answered Oct 14 '22 15:10

Michalis