Android self-signed MotionEvent APK

2019-09-14 18:22发布

问题:

I am developing an android APK that will do auto touch events in my mobile when certain button is clicked, I am following the solution provided by the link:

How to simulate touch from background service with sendevent or other way?

I have the signapk.jar from here, and I use the public and private test key provided also, the command I entered are:

java -jar ./signapk.jar ./testkey.x509.pem ./testkey.pk8 ./app-debug.apk ./app-signed.apk

and it did generate a new signed APK to me as I expected:

app-signed.apk

and I install and run the APK using the following commands:

adb install app-signed.apk
adb shell ps

whenever I click the button, nothing is happening, what am I doing it wrong?

NOTE

And when I enter the parameter:

android:sharedUserId="android.uid.system"

into my AndroidManifest.xml, an error occuring:

FAILURE [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE]

I never done this before, I never tried to self-signing an APK before, please guide me on what am I gone wrong. Thanks in advance.

回答1:

A few things:

Verify that your APK is signed correctly:

jarsigner -verify -verbose -certs app-signed.apk

Then use adb install -r app-signed.apk to replace the existing application.

See this guide for additional info on App signing.

Also preferably you should use the official Command Line Tools.

(I don't see the benefit in using the github project you were referring to and it also seems to be abandoned.)