2010-09-03 14 views
61

Ho scaricato e compilato la versione 2.1 di Android con l'immagine signed-google_ion-ota-14721.zip per il mio telefono HTC. La compilazione è stata completata con successo e quindi l'immagine del sistema lampeggia. Come posso firmare la mia applicazione Android con la firma del sistema?Come firmare un'app per Android con firma di sistema?

Qualcuno può descrivere l'intero processo per la firma di un'applicazione utente con firma di sistema poiché sono completamente nuovo nel processo di firma.

risposta

105

Finalmente sono riuscito a scoprire un modo per firmare la mia applicazione con la firma piattaforma. È necessario utilizzare i tasti situati in <root-of-android-source-tree>/build/target/product/security/ e aggiungere android:sharedUserId="android.uid.system" nel file AndroidManifest.xml.

Dettagli da 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

È possibile accettare la propria risposta per segnalare di aver trovato una soluzione per questo problema. ;) –

+1

Ma/build/target/product/security/dove posso ottenere questo percorso ?? – Ahmed

+2

@ user1155908: è nel codice sorgente di Android. Devi scaricare Android Open Source Project (AOSP): http://source.android.com/source/downloading.html –

8

La procedura funziona bene ho provato. Fintanto che non si dimentica di eseguire zipalign dopo la firma, i processi di firma lasciano l'APK non allineato e NON si installerà. Dovrai installare l'APK allineato.

zipalign -fv 4 YourApplication-signed.apk YourApplication-aligned.apk 
Problemi correlati