Forum Xamarin.Android

How to sign both handheld app and Android wear app from CI server.

hi folks,

We have problems signing an app with an Android Wear extension from the CI (Teamcity - F#). At the moment of building, both .apks are generated correctly:

-- res > raw > wearable_app.apk
-- res > xml > wearable_app_desc.xml

but at the moment of sign it using jarsigner only one .apk is signed (handheld) . The wearable_app.apk isn't signed and is rejected by Google Play store.

We adopted one solution later: open the unsigned handheld.apk, sign the wearable_app.apk and pack it again and sign the handheld.apk. It worked for Google Play store but still users can't see the wearable app.

This is a sample of the script we used:

    // Unpack the unsigned apk
    let unpackArgs = String.Format("d -s -o {0} {1}", basePath, unsignedApk)
    Shell.Exec ("apktool", unpackArgs) |> ignore

     // Sign wearable apk
    let jarsignerArgs = String.Format("-verbose -keystore {0} -storepass {1} {2} {3}", keyStorePath, keyStorePassword, unsignedWearableApk, keyStoreAlias)
    Shell.Exec ("jarsigner", jarsignerArgs) |> ignore

    // Pack solution again
    let packArgs = String.Format("b -o {0} {1}", signedWearableApk, basePath)
    Shell.Exec ("apktool", packArgs) |> ignore

    // Sign whole .apk and finish process
    let apkFileInfo = new FileInfo (signedWearableApk);
    AndroidSignAndAlign (fun defaults ->
        {defaults with
            KeystorePath = keyStorePath
            KeystorePassword = keyStorePassword
            KeystoreAlias = keyStoreAlias
        }) apkFileInfo
    |> ChangeFileName
    |> TeamCityHelper.PublishArtifact

doing the process with Xamarin Studio, everything is signed correctly in one step. Someone for Xamarin could tell us how to do it?
thanks in advance!

Sign In or Register to comment.