0

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.

Community
  • 1
  • 1
Lance Leroy
  • 399
  • 4
  • 7
  • 17
  • Hi, I suggest, that testkeys: "./testkey.x509.pem ./testkey.pk8" doesn't sign your app as system. – v1k Mar 12 '17 at 10:19
  • Also "adb shell ps" doesn't take part in app installation, it only show running processes on android device. I used it only for check if my app's process ran correctly. – v1k Mar 12 '17 at 10:22
  • I see, right now, I had generate my own key files, and it work only in the app, when I use the motionevent on another apps, it wont work and crashed, rooting the device is the only option? – Lance Leroy Mar 12 '17 at 11:40
  • 1
    I'm not sure, that device should be rooted, I think in this case I would notice about it in my answer about touch simulation. Anyway it worked with native android alarm clock app, and dismissed native alarm dialog, so it worked fine not only inside app. But it was working on Lollipop and previous versions, maybe politics has been changed. How did you generate your key files? In fact you should think about system app as an android build linked app, therefore you should use your android OS source key files and it would work only on android with the same files in source. – v1k Mar 12 '17 at 21:31
  • Yes I was suspect that android policy has updated, so previous solution that you found out has not working in current most recent androids, now I have solved it by rooting the device – Lance Leroy Mar 13 '17 at 08:55

1 Answers1

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.)

jhscheer
  • 342
  • 1
  • 8
  • 18