Signing Xamarin and APK - Changing the Path to JarSigner

When I create a Xamarin project, the version of the jarsigner tool it uses is ALWAYS from \ Java \ jdk1.6.0_39 \ bin \

I was wondering if we can change to another version of the JDK.

Looking at the output of the assembly, it seems that it comes down to the fact that MSBuild ../ Xamerin / Android.Build.Tasks.dll reports this .... (see below)

Is there a way to force the assembly to specify a different path ... a later version of the JDK? any

11>Using "AndroidSignPackage" task from assembly "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
11>Task "AndroidSignPackage"
11>  C:\Program Files (x86)\Java\jdk1.6.0_39\\bin\jarsigner.exe
+4
source share
1 answer

Xamarin Custom MSBuild Task Library (C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll) AndroidSignPackage extends AndroidToolTask, ToolTask . , , ToolPath.

MSBuild , :

<AndroidSignPackage
  UnsignedApk="pathtounsignedapk"
  SignedApkDirectory="signedapkoutputdir"
  Keystore="yourkeystorelocation"
  KeyAlias="thekeyaliasusedtosign"
  StorePass="thepasswordforthekeystore"
  ToolPath="NEWPATHTOJAVASDK" />

Visual Studio, *.Targets , MSBuild, .

, ,

Xamarin Toolchain Xamarin.Android.Common.targets(C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets) , AndroidSignPackage _Sign, , , , , ToolPath, $(JarsignerToolPath), .targets, , :

<CreateProperty Value="$(_JavaSdkDirectory)\bin">
    <Output TaskParameter="Value" PropertyName="JarsignerToolPath"
            Condition="'$(JarsignerToolPath)' == ''"
    />
</CreateProperty>

, ( , ), , $(JarsignerToolPath) , .

, , MSbuild $(JarsignerToolPath), . MSBuild, , .

( ) - MSBuild Script (, CSPROJ - MSBuild) ( ), , :

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|JDK17' ">
  <DebugType>pdbonly</DebugType>
  <Optimize>true</Optimize>
  <OutputPath>bin\Release\</OutputPath>
  ... (Additional properties trimmed) ...
  <JarsignerToolPath>C:\Program Files (x86)\Java\jdk1.7.0_71\bin</JarsignerToolPath>
</PropertyGroup>

Visual Studio/MSBuild, , JarsignerToolPath .

, , , $(_JavaSdkDirectory)...

+6

All Articles