can't sign android app lite version with same private key - android

i just signed my paid app and now i want to sign a lite version of it with the same private key. my problem now is that, am receiving this error:
jarsigner: unable to open jar file.
do i have to create another keystore for it? or is the problem coming from the fact that i am saving it as a different file name? what can i do? Thank you

The problem is definitely not related to the fact that it is a lite version. I find it curious that the error message is Jarsigner: Unable to open jar file.
Some searching around leads me to believe you are making some typing error in your command (please revisit the steps found here http://developer.android.com/guide/publishing/app-signing.html#signapp )
Also some other searching I did pointed to difficulties someone had with certain file names. Is your .APK name elaborate? Another instance of this problem I found ( http://coding.derkeiler.com/Archive/Java/comp.lang.java.help/2005-09/msg01002.html ) was claimed to be solved by simplifying the name.
Also make sure you are actually pointing to the .APK. Try typing out full paths to the file if you're not already.

I see an issue where i was using the full paths and it did not work, if you are having this problem, then just ensure that the .apk and the .keystore file is in the same destination. For my scenario I moved the apk to the root folder and run command and it worked. Hope this helps.

Related

issue installing apk modified in apktool

I've been trying to change the package name for an android apk, but I've ran into some trouble.
I changed the package name as per this answer, signed, and zipaligned it. However, whenever I try to adb install modified.apk, it gives me the following error:
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION]
How can I fix this? I have already tried changing all of the references to the old package name in the AndroidManifest.xml, but that caused some of the references to xml files in /res/ to break.
Any help would be appreciated.
Edit 12/15:
Still haven't figured this out and I can't find any documentation on this issue in the context of what I'm trying to do. Still looking for a solution.

Extracted code from apk showing a number of java code errors

I recently read about the concept of reverse engineering and wanted to try it.
So I downloaded an apk and extracted it source code by using
apktool, dex2jar and jd-gui
Every thing went on smoothly and I extracted the resource as well as java files successfully. However the problem arose when I tried to import this project in android studio.
Initially it was showing a number resource files related errors which I corrected by changing the dependencies of the project but now I am getting all these weird errors in java files.
The errors include "not a statement', 'variable not initialized' etc.
Kindly Help. Thanks in Advance!
I have extracted code from apk before myself, and the results I got were similar to yours. I got most of the code, but not all of it and not with all of the formatting. Numerical constants were missing and the the "if, while, for" instructions were faulty. I don't know if this always happens, I did it only once, but I managed to figure out the rest of the code by what this processes gave me in the begging.

"java.exe" exited with code 2

I added Google play services to my project for maps but now keep getting this error "java.exe" exited with code 2.
I am not sure if it is different from "java.exe" exited with code 1 but I have tried all the suggestions online
My heap size is 1G. My target version is 21, I have clean rebuild etc..
When I click on the error it takes me to this CompileToDalvik.
How can I resolve this? Even if I remove google play services I still get this error( clean / refresh rebuild etc..)
We had similar issues and nailed it down to our app going over 64k (65,536) methods limit which could be what's happening when you reference google play services.
Enabling multidex resolved our issue so may be worth trying.
Google Multi-Dex Reference:
http://developer.android.com/tools/building/multidex.html
Using Visual Studio and Xamarin I got this error because I had a wrong path for the Keystore in the .csproj file, and for some reason this path did not get updated while changing the path for the Keystore in the Visual Studio GUI.
Manual correcting the path in the .csproj file solved it for me.
None of the others answers worked for me. What worked for me (but I don't know why) was to empty my bin and obj directories before doing a rebuild.
I've seen this error recently. It was caused by an invalid (layout) xml file. Unfortunately, you don't get more hints where exactly the problem is :( I'd try to exclude the xml files one by one and check if the build succeeds without a certain file. Good luck!
Edit : I'm not even sure it actually was a layout xml file, maybe it has been a style or color xml :/ Any recent changes to one of those?
Increasing the Java Heap Size to 1G is worked for me!
Clean the Bin and the Obj folders, and rebuild again.
If it doesn't work please check different JDK version.
I had this error when switching from VS Mac to VS Windows.
Here the topic Switching From VS Mac To VS Windows got “java.exe” exited with code 2
The issue was comming from the Android.csproj and the Keystore Path.
It was set to my Mac Path even if I had already changed it on
VSWindows AndroidProject => Properties => Signin
So I removed this lines on Android.csproj (edited with third text editor):
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>YourMacPath/Alias.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>Password</AndroidSigningStorePass>
<AndroidSigningKeyAlias>Alias</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>AliasPassword</AndroidSigningKeyPass>
On debug & release Part.
Then you can edit them on VS Windows.
Hope I helped someone.
See ya
Now in VS 2022, I had the very same problem and nothing would work. I had noticed that, at least in my case, problem started when I accidentally lost the certificate from the keystore. For debugging mode I just took the signature out since it provides it's own. However, I will need to re-add the key once I change to release. Once the proper key is found in the keystore, the problem is resolved. Apparently that error code is useless.

Installation Failed due to Invalid URI? Installs only in debug mode?

What are the possible causes of android failed to install. Invalid URI? What URI is this referring to and in what way is it invalid? It works fine in debug mode, but I cannot get it to install outside of debug mode.
Thanks
This error can point to so many different things, and there is many different fixes. To sum those I've gathered:
Problems with Eclipse: Clean project, rebuild project, restart eclipse.
Invalid characters: Remove any special characters in Eclipse project name. Use only [a-z] and [0-9] not even [ ] (whitespace)
Error in included jar: Try without jar and see if it runs, if does fix somehow.
Errors in manifest package setup: Right click in eclipse on project -> Android tools -> Rename application package (rename to something similar, you can always rename back).
Problems with device: Remove app from device and try re install.
ingyesid above basically means you need to refactor your project name to not include any non en/us characters. This will then change the apk filename which also cannot have accented letters eg; "ÖÄÅåäöééıßç....etc".. (and neither can any 'res' asset" have these). I had this problem recently when doing swedish, make sure project name and all filenames are in ENGLISH chars/nums only.
-You can however set your appname variable in "res/values/Strings" to the proper international chars.
This is either a bug or some shortsightedness on behalf of android devs. :/
not have accents or unusual characters. I had the accent and the name of the apk generated an error when going to install, remove the tick and it worked
/data/local directory has no permissions for writing, executing on "others".
You must use a superuser App and modify permissions for /data/local.
Setting them to rwxrwxrwx will work
This problem occurs if you have placed inavalid name of the project like MyAPP_$33, SO ONLY Letters [a---z] and digits [0,1,2...] are allowed .
No special characters are allowed during naming the project

What is resources.ap_ and why does it have a penchant for not existing?

Every once in a while a borked Eclipse build gets nailed down to the absence of this file, with the simple fix of cleaning the build, or occasionally doing a deeper clean on the project's metadata. I can live with this state of affairs, but the curious side of me has to ask why.
A search for it on developer.android.com turns up nothing :(, and a search on Google turns up various threads by folks wondering why their build is broken.
This guy is the closest thing I've found to an explanation of the thing itself. Hopefully some nice, patient guru can shed some light on the fundamentals here without this noob digging too far into the source :)
The resource.ap_ is all the resources for you file zipped up. Everything from the res, assets folders and the Manifest file.
The apk file added in the class.dex (all your compiled code) and any linked .so (native code).
Both of these files are in .zip format. They can easily be view by changing the extension to .zip and opening them.
The .ap_ file is probably your apk before it is signed with your certificate (by default, a debug certificate generated by ADT in your home directory.)
here is a picture which may give you the answer.

Categories

Resources