I would like to know how to verify an apk signature (and installer) from a shell command prompt.
Thanks
Based on the Android documentation, to verify your apk from the shell apksigner verify my-app.apk
Sign Your App Manually
Related
I am getting this:
01/20 17:14:40: Launching MyLuaGame $ adb push /Users/name/Desktop/MyLuaGame/frameworks/runtime-src/proj.android-studio/app/build/outputs/apk/MyLuaGame-debug.apk /data/local/tmp/myTest
$ adb shell pm install -r "/data/local/tmp/myTest" Please select on your phone whether can install the app by The ADB command?
pkg: /data/local/tmp/myTest Failure [INSTALL_FAILED_INVALID_APK]
$ adb shell pm uninstall myTest DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
You have to execute a release apk for installation in device. You can connect your device in android studio and get the debug version app but in order to get an apk to install other devices, you must execute release version apk using a keystore
A common reason for this error is having an app with the same package name already installed but with a different certificate e.g. a store release or a development build from another machine.
Try uninstalling the package with ADB first, using adb uninstall YOUR_PACKAGE_NAME
How to check if apk is debug or release signed?
Is there any direct adb command to verify apk signature?
Tried the following dumpsys and aapt commands, but I am not able to find the exact flag
adb shell dumpsys package <package name>
aapt dump badging <apk file>
How to find out the given apk is debug or release signed? How to know which builds (user, userdebug or eng) we can install this apk?
If you want to check whether the apk is debuggable use the below aapt command.
aapt dump badging /path/to/apk | grep -c application-debuggable
Outputs 1: Debuggable
Outputs 0: Not Debuggable.
i've tried a lot of stuff and came upon the following solution:
adb shell dumpsys package <package name> | findstr flags
if the build is debuggable, the "flags" line will have "DEBUGGABLE" parameter present. If it's not there, the build is not debug
You seem to be confused. Apks usually have debug and release versions. And eng, userdebug and user build types are used for the whole firmware images.
You can find build information (if properly populated by builder) by using
adb shell getprop ro.build.fingerprint
run-as might provide a hint:
$ adb shell run-as com.example.foo.bar
run-as: package not debuggable: com.example.foo.bar
Following is the command and error:
[raj#raj-arch apk]$ adb install android-armv7-release-unsigned.apk
[100%] /data/local/tmp/android-armv7-release-unsigned.apk pkg:
/data/local/tmp/android-armv7-release-unsigned.apk Failure
[INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION] rm failed for -f, No such
file or directory
I'm using Ionic and Cordova. Really not sure what's going on with that error though.
try ionic run android or ionic emulate android if on emulator.
Don't mix those.
you can't install unsigned APKs.
Even if it's signed with the debug key, Android only allows a signed APK to be installed.
So you can either follow some of those https://developer.android.com/studio/publish/app-signing.html#signing-manually or How to use jarsigner for signing an apk?
or use the debug version:
adb install android-armv7-debug.apk
I am attempting to sideload an APK with ADB. When I downloaded it, it was unsigned, but I attempted to install it, unknowingly, and it failed since it was unsigned. I signed it manually and verified that it was signed correctly, but when I go to install it with adb install -r <path to signed apk>, I get the following error:
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
So I found this question that said to uninstall the old application that was unsigned, but I can't find the application on my device or anywhere in adb, so how am I supposed to uninstall the unsigned APK that failed to install in the first place? Or is there something I'm missing?
To uninstall you must know the package name of the application, Not the file name.
Usage Example: adb uninstall com.google.android.youtube (uninstalls youtube)
I try to sign Trebuchet launcher with platform certificate, but it fails to install after that:
$ java -jar out/host/darwin-x86/framework/signapk.jar build/target/product/security/platform.x509.pem build/target/product/security/platform.pk8 out/target/product/crespo/system/app/Trebuchet.apk CapsuleLauncher.apk
$ adb -e install -r CapsuleLauncher.apk
1916 KB/s (7946887 bytes in 4.049s)
pkg: /data/local/tmp/CapsuleLauncher.apk
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
If I do not sign it - it installs successfully. How to sign it?
INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES means that you used the wrong certificate to sign your app.
Signing with the platform certificate only works if you build an app for your custom firmware rom where you know the certificate. It does not work if you use the standard firmware of a device since the manufacturers keep their certificates a secret.
If you don't sign it the app won't get any system priviledges but will still run.