2

I've downloaded an Android system application source code.

When I import the project in eclipse and try to run it in the emulator it shows signature error. I think this happens because the package name in manifest is suppossed to be different than any applications already installed in the phone, but when I try to change the package name in manifest file the autogenerated R.java file gets deleted.

Now my questions are

  1. how can I avoid this Signature mismatch error?

  2. how can I modify package name in manifest file so that R.java file doesn't get deleted?

Or how can I simply android System application from eclipse?

shkschneider
  • 17,833
  • 13
  • 59
  • 112
sha256
  • 3,029
  • 1
  • 27
  • 32

5 Answers5

1

Why not try to recreate the whole android app? I mean, since you donwloaded it, just create a new blank android app and create necessary classes, xmls, changest to manifest file and copy the codes you have and paste it with the new one. With this, you will be able to see one by one how the code works and debug it just the way you create it. Hope this somewhat helps.

Luke Villanueva
  • 2,030
  • 8
  • 44
  • 94
  • yes, that's a good workaround but what if the number of classes are way too large? ;-) – sha256 Aug 22 '12 at 08:23
  • Well I didn't assumed that, :)) there's a lot of solutions out there. goodluck. I haven't encountered your problem. Since I haven't try to download a whole android system application. – Luke Villanueva Aug 22 '12 at 08:29
1

To make system application, your application must have product signing key(signature) which matched to real device. That key is in \build\target\product\security\

1

Quoting from https://stackoverflow.com/a/9645224/1163019

"If you want a signatureOrSystem permission, you just need to be placed on the system image; you don't need to be signed with any special cert. You can do this as a one-off (until you exit the emulator) like this:"

> adb root
> adb remount
> adb push /path/to/My.apk /system/app/My.apk

You can update the package name in eclipse, using "Android Tools". Right click on project, choose "Rename Application Package" under "Android Tools". That should refactor the code as needed.

Community
  • 1
  • 1
auselen
  • 27,577
  • 7
  • 73
  • 114
  • doesn't make sense unfortunately :( – sha256 Aug 22 '12 at 08:31
  • After building your app under eclipse with its original form, you need to push resulting apk on top of the one on the emulator as described above. After this you should be able to run under eclipse directly. or is it something else that was confusing? – auselen Aug 22 '12 at 08:34
  • I don't want to replace the original app, I want it to be a separarte app which i can be able to install on my phone. If i want to do this, shoudn't the package name in manifest file be different than any other app installed on the phone? – sha256 Aug 22 '12 at 08:44
  • Yes you are correct, package name in manifest needs to be different. I've updated my answer, suggesting a way to do that easily. – auselen Aug 22 '12 at 08:47
1

All right, I've figured that out.

It was giving signature error because the package name in manifest file i.e. com.android.inputmethods.latin matches with already installed android's default Android Keyboard. So I needed to change the package name in manifest file. I changed that, But then a new problem came forward, The R.java file got deleted automatically.

That happened because, as I changed package name I needed to update that in some XML files. So logically until I did that there were some errors in XML files.

And the R.java file is generated automatically when there's no error in XML files. So when I updated the XML files & fixed the error in there, R.java file generated automatically.

Hope this helps someone :)

sha256
  • 3,029
  • 1
  • 27
  • 32
1
adb push myApk.apk /system/app
Hiren Patel
  • 52,124
  • 21
  • 173
  • 151