2010-09-03 4 views
61

J'ai téléchargé et compilé la version Android 2.1 avec l'image signed-google_ion-ota-14721.zip pour mon téléphone HTC. La compilation s'est terminée avec succès et l'image du système clignote. Comment puis-je signer ma propre application Android avec la signature du système?Comment signer une application Android avec la signature du système?

Est-ce que quelqu'un peut décrire l'ensemble du processus de signature d'une application utilisateur avec la signature du système car je suis complètement nouveau dans le processus de signature.

Répondre

105

Enfin, j'ai réussi à trouver un moyen de signer mon application avec la signature de la plate-forme. Vous devez utiliser les touches situées au <root-of-android-source-tree>/build/target/product/security/ et ajouter android:sharedUserId="android.uid.system" dans votre fichier AndroidManifest.xml.

Détails de 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.
+0

Vous pouvez accepter votre propre réponse pour indiquer que vous avez trouvé une solution à ce problème. ;) –

+1

Mais/build/cible/produit/sécurité/où je peux obtenir ce chemin ?? – Ahmed

+2

@ user1155908: il est dans le code source d'android os. Vous devez télécharger Android Open Source Project (AOSP): http://source.android.com/source/downloading.html –

8

La procédure fonctionne très bien Je l'ai essayé. Tant que vous n'oublierez pas d'exécuter zipalign après la signature car le processus de signature laisse le fichier APK non aligné et qu'il ne sera pas installé. Vous devrez installer le fichier APK aligné.

zipalign -fv 4 YourApplication-signed.apk YourApplication-aligned.apk 
Questions connexes