Re-sign an Android Apk

别说谁变了你拦得住时间么 提交于 2020-01-10 14:01:15

问题


How can I Re-sign an android apk. I referred to this answer Can I re-sign an .apk with a different certificate than what it came with?

but got stuck with Android Manifest.xml missing error.


回答1:


Friends I found a work around to this . Resign Android Apk using android default debug.keystore.

  1. **Open the apk in the winzip browser and not by unzipping to a folder.

  2. Delete META-INF folder .zipping again is not required.**

  3. Jarsigner -verbose -keystore debug.keystore yourapk.apk aliasname

    **Example** `-Jarsigner –verbose –keystore debug.keystore androiddebugkey.`
    
  4. jarsigner -verify yourapk.apk

  5. zipalign -v 4 yourapk.apk signedapk.apk

Step 1 and 2 was where I was doing wrong which gave me androidmanifest xml missing error.




回答2:


Downgrading to JDK 1.6.0_43 solved the problem.

To sign apks using JDK 1.7 one has to use these keywords "-sigalg MD5withRSA -digestalg SHA1"

Reason: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK.

Command: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias_name



来源:https://stackoverflow.com/questions/7119839/re-sign-an-android-apk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!