I am a student interested in Android Security. I was trying to modify a APK file using baksmali and smali. However, I am not able to run the repackaged app in my mobile. When I click on the icon it say Unfortunately, test has stopped and exists. (Even the icon of the app got changed, now I see default android icon instead of old real colorful icon of the app)    What could be the reason for this ? Actually I haven't even modified code of the apk file. I just unzipped apk to get dex file, then I converted it to smali using baksmali.jar, and then back to dex using smali.jar. Finally zipped and signed. What I have done in detail:Decompress the apk file$   Unzip test.apkConvert 1classes.dex1 to smali$ baksmali -x classes.dex -o smaliClassesConverted the classes back to classes.dex (replaced old classes.dex, in fact I did not add any new code to smali file. I wanted to know whether this works first).$ smali smaliClasses -o classes.dexZip all the files to test.zip$ zip test.zip AndroidManifest.xml classes.dex res META-INF resourses.arscRename test.zip to test.apk$ mv test.zip test.apkNow I believe I have to sign the APK again, please correct me if am wrong here.Edited:java -jar signapk.jar testkey.x509.pem  testkey.pk8 test.apk  test-patched.apkI tried to install the new repackaged APK. Using adb shell. Adb shell showed it successfully installed. However, I am not able to run the repackaged app in mobile. The App crashes when I click on it. It says Unfortunately, test has stopped.Why doesn't the repackaged app running ? I don't understand what I am missing here ?Edited:I tried to repackage the same app using apktool. I extracted the smali files using it and repackaged. But why repackaging is not working with baksmali, smali, zip and signapk. Is zipping the real problem in this procedure? I see the size of the app is reduced drastically when I zip it and rename it to .apk compared to the original apk file :| 
Repackaging APK file using baksmali and smali
android;apk