I am attempting to add google map functionality to my mono for android application by following these instructions.
I have created a public.keystore and I am trying to use this keystore to sign the application by following these instructions, which I do not find explicit enough.
1) I gather I must add the following block into the csproj file. Is this correct?
<PropertyGroup>
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>public.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>public</AndroidSigningStorePass>
<AndroidSigningKeyAlias>public</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>public</AndroidSigningKeyPass>
</PropertyGroup>
2) What is the correct location of the public.keystore file?
I completely failed to register that there was full sample solution, as part of the instructions I was trying to follow that, that answered my questions.
I am a giddy goat.
1) You should, but I don't know if you must. If you do then you may need to change some of the values.
Consider a keystore that is created by the command:
keytool.exe -genkey -v -alias public -keyalg RSA -keysize 2048 -validity 10000 -keystore public.keystore
Then:
<AndroidSigningKeyStore>public.keystore</AndroidSigningKeyStore>
Defines the filename of the keystore ie. public.keystore
<AndroidSigningKeyAlias>public</AndroidSigningKeyAlias>
Is the alias of the key within the keysotre that you want to use. ie. public
<AndroidSigningStorePass>public</AndroidSigningStorePass>
Is the keystore's password. This will be the first password that you were prompted for.
<AndroidSigningKeyPass>public</AndroidSigningKeyPass>
Is the key's password. This will be the second password that you were prompted for.
References
http://developer.android.com/guide/publishing/app-signing.html#cert
http://android.xamarin.com/Documentation/Build_Process#Signing
2) You can place public.keystore in the root of the project, but you don't have to add it to the solution.
To location of the keystore file is defined by the following element from Question 1:
<AndroidSigningKeyStore>public.keystore</AndroidSigningKeyStore>
I am using command file to sign the package.
"C:\Program Files\Java\jdk1.6.0_25\bin\jarsigner.exe" -verbose -keystore key.keystore myapplication.apk keyalias
"C:\Program Files\Android\android-sdk\tools\zipalign.exe" -v 4 myapplication.apk myapplication-Signed.apk
Related
There is an apk installed on the emulator manually. I want to start testing this application. You cannot reinstall it using Xamarin UI Tests. AppInitializer.cs contains :
string keyStore = #"C:\...\Certificate\Mycompany.keystore";
return ConfigureApp
.Android
.InstalledApp("com.myapk.test")
.PreferIdeSettings()
.KeyStore(
keyStore,
"passw",
"passw",
"\"alias\"")
.EnableLocalScreenshots()
.StartApp();
When I run the test through Test Explorer, I catch the Exception:
System.Exception : Failed to execute: C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\bin\jarsigner.exe -sigalg SHA1withRSA -digestalg SHA1 -signedjar "C:\Users\user\AppData\Local\Temp\uitest\a-287A94...D0807\23248\SignedTestServer.apk" -storepass passw -keypass passw -keystore "C:\...\Certificate\Mycompany.keystore" "C:\Users\user\AppData\Local\Temp\uitest\a-287A...D0807\TestServer.apk" ""alias"" - exit code: 1
Only one alias can be specified
Please type jarsigner -help for usage
Ok, I've just executed it manually :
jarsigner.exe -sigalg SHA1withRSA -digestalg SHA1 -signedjar "C:\Users\user\AppData\Local\Temp\uitest\a-287A94...D0807\23248\SignedTestServer.apk" -storepass passw -keypass passw -keystore "C:...\Certificate\Mycompany.keystore" "C:\Users\user\AppData\Local\Temp\uitest\a-287A...D0807\TestServer.apk" "alias"
After that I got a new apk file called SignedTestServer.apk. I've copied it into folder :
C:\Users\user\AppData\Local\Temp\uitest\a-287A943C412ED6ED5DEB1675E7FDF91843FD0807
and rerun tests.
#echo off
set spassw="password"
set kpassw="password"
cordova build android --release --keystore="developer.keystore" --storePassword=%spassw% --alias=developer --password=%kpassw% --prod
del app-release-unsigned.apk
move e:\MobileJs\chatapp\ChatApp\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk e:\MobileJs\chatapp\ChatApp\
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore developer.keystore app-release-unsigned.apk developer
ERROR: jarsigner error: java.lang.RuntimeException: keystore load: Invalid keystore format
I wrote a cordova build script and I cant seem to sign the APK
this is what my keystore generation looks like
keytool -genkey -v -keystore developer.keystore -alias developer -keyalg RSA -keysize 2048 -validity 10000
Password: password
What is your first and last name?
[Unknown]: First Last
What is the name of your organizational unit?
[Unknown]: n/a
What is the name of your organization?
[Unknown]: n/a
What is the name of your City or Locality?
[Unknown]: City
What is the name of your State or Province?
[Unknown]: State
What is the two-letter country code for this unit?
[Unknown]: US
could it be the n/a
you can refer here for keystore generation. enter link description here after generating keystore you can sign enter link description here your apk. After following these procedure if you are not able to generate feel free to ask.
Resign
D:\test>bundle exec calabash-android resign app-staging.apk
D:\test>
When i do run/build
D:\test>bundle exec calabash-android run app-staging.apk
No test server found for this combination of app and calabash version. Recreating test server.
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
WARNING: skipped META-INF/CERT.RSA as unsafe
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:188:in block (2 levels) in fingerprint_from_apk': No s re files found in META-INF. Cannot proceed. (RuntimeError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:170:inchdir'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:170:in block in fingerprint_from_apk' from C:/Ruby23-x64/lib/ruby/2.3.0/tmpdir.rb:89:inmktmpdir'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:169:in fingerprint_from_apk' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android-build.rb:2:incalabash_build'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/lib/calabash-android/helpers.rb:107:in build_test_server_if_needed' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android-run.rb:16:incalabash_run'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/calabash-android-0.9.6/bin/calabash-android:86:in <top (required)>' from C:/Ruby23-x64/bin/calabash-android:22:inload'
from C:/Ruby23-x64/bin/calabash-android:22:in
If you do not have debug.keystore file create it bu the following command, you need keytool which is in JAVA_HOME/bin:
keytool -genkey -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
Then run the calabash-android setup to assign this debug.keystore:
$ calabash-android setup
Please enter keystore information to use a custom keystore instead of the default
Please enter keystore location
...
I want to manually add .mobileprovision to the keychain access without using xCode because I didn't develop the app with xCode. Any suggestions?
I found a YouTube video by Kotobee to be immensely helpful.
You will need an OpenSSL. All necessary info is within this video.
My personal notes from this video:
Step 1: Need Open SSL folder
Step 2:
Process of making the KEYS
https://youtu.be/yCvbbIfMnxI?t=6m
https://youtu.be/yCvbbIfMnxI?t=8m4s
1ST KEY
certificate signing request file (CSR)
open SSL file in COMMAND PROMPT (cmd)
openssl genrsa -out [keyname].key 2048
// optional change [keyname]
(NOTE: if issues locating openssl.cfg type at command prmpt
set OPENSSL_conf-d:\OpenSSL-Win64\bin\openssl.cfg
nothing will show on command prmpt, but continue)
2ND KEY
making the CertificateSigningRequest.certSigningRequest KEY
//// video timestamp around 13:00 //////
openssl req -new -key [keyname].key -out CertificateSigningRequest.certSigningRequest -subj "/emailAddress=yourEmail#whatever.com, CN= companyName, C=US"
C=US is about the country of origin. So you may need to change this if not US.
NOTE: SEEMS LIKE ONCE YOU HAVE THE KEY FROM OPENSSL, don't need to do this process again. Not positive though, but so far seems true.
3RD KEY
https://youtu.be/yCvbbIfMnxI?t=14m52s
log into developer.apple.com account
3 steps:
STEP A:
Certificates
there's a DIFFERENCE between DEVELOPMENT & PRODUCTION/DISTRIBUTION
Click the PLUS sign in upper right corner of web page.
You can likely reUPLOAD the SAME key created under name:
CertificateSigningRequest.certSigningRequest
dev site will return "Your certificate is ready" to download
file name will be
ios_distribution.cer for DISTRIBUTION KEY
ios_development.cer for DEVELOPMENT KEY
/// NOTE: SO FAR LOOKS LIKE YOU CAN USE SAME KEY ONCE MADE!
Put your .cer file into the OpenSSL bin folder
STEP B:
Make your APP ID via the developer.apple.com site
https://youtu.be/yCvbbIfMnxI?t=16m58s
THIS SECTION appears to need to change per app, especially for DISTRIBUTION
could just use the wildcard key and be done with it for DEVELOPMENT
STEP C: Create .mobileprovision file
(note: this will include your registered devices)
Make an APP ID
click on Identifiers > App IDs >
Explicit App: Dev Prov Profile
App Bundle: id="com.domain.app"
Enabled: Push Notifications (can exclude this line)
Download new .mobileprovision file from developer.apple.com into
D:\OpenSSL-Win64\bin
Make sure latest CertificateSigningRequest.certSigningRequest file in
D:\OpenSSL-Win64\bin
Along with .key file in D:\OpenSSL-Win64\bin
STEP D: Create .pem file
In Command Prompt type:
openssl x509 -in [developer_certificate].cer -inform DER -out [app_pem_file].pem -outform PEM
ios_distribution.cer OR ios_development.cer
rename the [app_pem_file].pem file if you like -- make it similar (my thought)
to bundle app ID name or Explicit App name
OR
make it same as the .key name (if recreating & not using a previous one)
this creates the .PEM file
STEP E: Create .p12 file (final task)
In Command Prompt type:
openssl pkcs12 -export -inkey [keyname].key -in [app_pem_file].pem -out [app_p12].p12
As I said, all this information is on the video. You don't need my personal notes to get the key. :)
I have created a gradle project and everything builds fine, but when I try to upload to my Maven repository, I get the following Gradle error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not evaluate onlyIf predicate for task ':library:signArchives'.
> Unable to read secret key from file: C:\Users\ideal\pubring.gpg (it may not be a PGP secret key ring)
I followed the instructions at Sonatype to generate the key, then copied it from its generated location to the location listed above. I have also published the public key to MITs key repository. The gradle.properties file in my user directory contains the following entries related to the keychain:
signing.keyId=MY_KEY_ID
signing.password=MY_KEY_PASSWORD
signing.secretKeyRingFile=C:\\Users\\ideal\\pubring.gpg
This is on a Windows platform. I have tried searching for the error message but the only thing which comes up is the source files for the related plugins.
The secring.gpg file has been removed in GPG 2.1.
However, GPG still can create such a file: gpg --export-secret-keys -o secring.gpg
Pro Tip: If Gradle's signing plugin complains that your key in signing.keyId=MY_KEY_ID is too long, you're certainly using the 40 characters fingerprint but are asked for the 8 char ID. You've got three options then:
You can configure GPG to show the 8 char ID instead of the fingerprint by setting the keyid-format option.
a) Either explicitly define this option on CLI: gpg --list-keys --keyid-format short (Thanks tjheslin1!)
b) Or activate this option implicitly through the options file (default location is ~/.gnupg/gpg.conf).
Try the last 8 digits of your 40 chars fingerprint. This is for the lazy developer ;-)
The problem is that you are using the public key, switch to the secret key, normally named "secring.gpg".
So in your case it should placed in
C:\Users\ideal\secring.gpg
The "secring.gpg" file may not be needed in GPG 2.1 and later versions, and can be generated with commands:
"gpg --export-secret-keys -o \dir\secring.gpg"