2

我正在尝试将 Parse Android Java SDK 绑定到 Xamarin.Android

我已经按照本教程http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)

我添加 Parse_1.3.4.jar 作为 EmbeddedJar 和 android-support-v4.jar 和 Facebook_Android_SDK_v3.5.jar 作为 EmbeddedReferenceJar

我正在使用 Visual Studio 2012,在构建项目时出现 1 个错误(“java.exe”退出,代码为 1)和 12 个警告。输出如下:(也请参阅更新)

1>------ Build started: Project: CompanyII.Blink.Mobile.Android.JLibrary, Configuration: Debug Any CPU ------
1>Build started 31/08/2013 17:22:14.
1>ResolveLibraryProjects:
1>Skipping target "ResolveLibraryProjects" because it has no inputs.
1>_ResolveMonoAndroidSdks:
1>  MonoAndroid Tools: C:\Program Files (x86)\MSBuild\Xamarin\Android\
1>  MonoAndroid Framework: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.2\;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\
1>  Android SDK: C:\Users\Account\Android_Dev\sdk\
1>  Java SDK: C:\Program Files\Java\jdk1.7.0_25\
1>  Android Platform API level: 17
1>  TargetFrameworkVersion: v4.2
1>ExportJarToXml:
1>    Assemblies: 
1>      C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.2\Mono.Android.dll
1>      C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
1>      C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
1>    Jars: 
1>    ResolvedResourceDirectories: 
1>    SourceJars:
1>      Jars\Parse-1.3.4.jar
1>    ReferenceJars:
1>      Jars\Facebook_Android_SDK_v3.5.jar
1>      Jars\android-support-v4.jar
1>  C:\Program Files\Java\jdk1.7.0_25\bin\java.exe -jar "C:\Program Files (x86)\MSBuild\Xamarin\Android\jar2xml.jar" --jar=C:\Users\Account\CompanyII\Blink\CompanyII.Blink.Mobile\CompanyII.Blink.Mobile.Android.JLibrary\Jars\Parse-1.3.4.jar --ref=C:\Users\Account\Android_Dev\sdk\platforms\android-17\android.jar --out=C:\Users\Account\CompanyII\Blink\CompanyII.Blink.Mobile\CompanyII.Blink.Mobile.Android.JLibrary\obj\Debug\api.xml --ref=C:\Users\Account\CompanyII\Blink\CompanyII.Blink.Mobile\CompanyII.Blink.Mobile.Android.JLibrary\Jars\Facebook_Android_SDK_v3.5.jar --ref=C:\Users\Account\CompanyII\Blink\CompanyII.Blink.Mobile\CompanyII.Blink.Mobile.Android.JLibrary\Jars\android-support-v4.jar 
1>  Exception in thread "main" java.lang.InternalError: Enclosing method not found
1>      at java.lang.Class.getEnclosingMethod(Class.java:952)
1>      at sun.reflect.generics.scope.ClassScope.computeEnclosingScope(ClassScope.java:50)
1>      at sun.reflect.generics.scope.AbstractScope.getEnclosingScope(AbstractScope.java:74)
1>      at sun.reflect.generics.scope.AbstractScope.lookup(AbstractScope.java:90)
1>      at sun.reflect.generics.factory.CoreReflectionFactory.findTypeVariable(CoreReflectionFactory.java:110)
1>      at sun.reflect.generics.visitor.Reifier.visitTypeVariableSignature(Reifier.java:165)
1>      at sun.reflect.generics.tree.TypeVariableSignature.accept(TypeVariableSignature.java:43)
1>      at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
1>      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
1>      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
1>      at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
1>      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
1>      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
1>      at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:100)
1>      at java.lang.Class.getGenericInterfaces(Class.java:814)
1>      at jar2xml.JavaClass.getGenericInterfaces(JavaClass.java:212)
1>      at jar2xml.JavaClass.doAppendToDocument(JavaClass.java:593)
1>      at jar2xml.JavaClass.appendToDocument(JavaClass.java:544)
1>      at jar2xml.JavaPackage.appendToDocument(JavaPackage.java:72)
1>      at jar2xml.Start.main(Start.java:119)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets(245,5): error MSB6006: "java.exe" exited with code 1.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.17
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

更新:

当我单击错误时,它会将我带到 Xamarin.Android.Bindings.targets 文件的第 245 行,其中包含<JarToXml似乎是问题原因的函数/字段。

Xamarin.Android.Bindings.targets 位于 C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets

我已经在下面复制了它以防万一

<!--
***********************************************************************************************
Xamarin.Android.Bindings.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
  created a backup copy.  Incorrect changes to this file will make it
  impossible to load or build your projects from the command-line or the IDE.

This file imports the version- and platform-specific targets for the project importing
this file. This file also defines targets to produce an error if the specified targets
file does not exist, but the project is built anyway (command-line or IDE build).

Copyright (C) 2012 Xamarin Inc. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="Xamarin.Android.Tasks.BindingsGenerator" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.GetApiLevelFromFramework" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.JarToXml" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.CollectLibraryInputJars" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.CreateLibraryResourceArchive" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.CreateTemporaryDirectory" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.RemoveDirFixed" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.ResolveAssemblies" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.ResolveLibraryProjectImports" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.ResolveSdks" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
  <UsingTask TaskName="Xamarin.Android.Tasks.CreateNativeLibraryArchive" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />

  <PropertyGroup>
    <AndroidUseLatestPlatformSdk Condition="'$(AndroidUseLatestPlatformSdk)' == ''">False</AndroidUseLatestPlatformSdk>
    <TargetFrameworkIdentifier>MonoAndroid</TargetFrameworkIdentifier>
    <MonoAndroidVersion>v1.0</MonoAndroidVersion>
  </PropertyGroup>

  <!-- Get our Build Actions to show up in VS -->
  <ItemGroup>
    <AvailableItemName Include="EmbeddedJar" />
    <AvailableItemName Include="EmbeddedNativeLibrary" />
    <AvailableItemName Include="EmbeddedReferenceJar" />
    <AvailableItemName Include="InputJar" />
    <AvailableItemName Include="ReferenceJar" />
    <AvailableItemName Include="TransformFile" />
    <AvailableItemName Include="LibraryProjectProperties" />
    <AvailableItemName Include="LibraryProjectZip" />
  </ItemGroup>

  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />

  <!-- workaround for broken ResolveReferences deps in xbuild 2.8 -->
  <PropertyGroup>
    <ResolveReferencesDependsOn>GetFrameworkPaths;$(ResolveReferencesDependsOn)</ResolveReferencesDependsOn>
  </PropertyGroup>

  <!-- override GetFrameworkPaths since xbuild doesn't yet support TargetFrameworkIdentifier -->
  <Target Name="GetFrameworkPaths" DependsOnTargets="_ResolveMonoAndroidSdks" Condition="'$(OS)' == 'Unix'">
    <CreateItem Include="$(_MonoAndroidFrameworkDirectories)">
      <Output TaskParameter="Include" ItemName="TargetFrameworkDirectories"/>
      <Output TaskParameter="Include" ItemName="_FrameworkPath"/>
    </CreateItem>
    <CreateProperty Value="smcs">
      <Output TaskParameter="Value" PropertyName="CscToolExe"/>
    </CreateProperty>
    <CreateProperty Value="$(_MonoAndroidToolsDirectory)../../bin/">
      <Output TaskParameter="Value" PropertyName="CscToolPath"/>
    </CreateProperty>
    <CreateProperty Value="@(TargetFrameworkDirectories)">
      <Output TaskParameter="Value" PropertyName="TargetFrameworkDirectory"/>
      <!-- Workaround: Set $(_TargetFrameworkDirectories), so that GetReferenceAssemblyPaths doesn't
             try to resolve the $(TargetFrameworkMoniker), as this target file doesn't support that
             with xbuild, yet. -->
      <Output TaskParameter="Value" PropertyName="_TargetFrameworkDirectories" Condition="'$(OS)' == 'Unix'"/>
    </CreateProperty>
  </Target>

  <!--
    On Windows/MSBuild, use the MSBuild 4.0 TargetFrameworkVersion and reference
    assemblies system to resolve the MonoAndroid framework directories
  -->
  <Target Name="_ResolveMonoAndroidFrameworkWindows" Condition="'$(Os)'!='Unix'" DependsOnTargets="GetReferenceAssemblyPaths" >
    <!-- MSBuild is going to calculate this for us -->
    <CreateProperty Value="$(_TargetFrameworkDirectories)" Condition="'$(MonoAndroidFrameworkDirectories)'==''">
      <Output TaskParameter="Value" PropertyName="MonoAndroidFrameworkDirectories"/>
    </CreateProperty>
  </Target>

  <PropertyGroup>
    <GeneratedOutputPath Condition="'$(GeneratedOutputPath)' == ''">$(IntermediateOutputPath)generated\</GeneratedOutputPath>
    <ApiOutputFile Condition="'$(ApiOutputFile)' == ''">$(IntermediateOutputPath)api.xml</ApiOutputFile>
    <_GeneratorStampFile>$(IntermediateOutputPath)generator.stamp</_GeneratorStampFile>
  </PropertyGroup>

  <PropertyGroup>
    <BuildDependsOn>
      GetFrameworkPaths;
      AddLibraryJarsToBind;
      AddBindingsToCompile;
      AddEmbeddedJarsAsResources;
      AddEmbeddedReferenceJarsAsResources;
      AddLibraryProjectsToCompile;
      _AddNativeLibraryArchiveToCompile;
      $(BuildDependsOn);
    </BuildDependsOn>

    <CleanDependsOn>
      $(CleanDependsOn);
      CleanBindingsOutput;
      CleanLibraryProjectIntermediaries;
    </CleanDependsOn>
  </PropertyGroup>


  <!-- Find all the needed SDKs -->
  <Target Name="_ResolveMonoAndroidSdks" DependsOnTargets="_ResolveMonoAndroidFrameworkWindows">

    <ResolveSdks
        AndroidApiLevel="$(AndroidApiLevel)"
        AndroidSdkBuildToolsVersion="$(AndroidSdkBuildToolsVersion)"
        AndroidSdkPath="$(AndroidSdkDirectory)"
        BuildingInsideVisualStudio="$(BuildingInsideVisualStudio)"
        TargetFrameworkVersion="$(TargetFrameworkVersion)"
        UseLatestAndroidPlatformSdk="$(AndroidUseLatestPlatformSdk)">
      <Output TaskParameter="AndroidApiLevel" PropertyName="_AndroidApiLevel" />
      <Output TaskParameter="TargetFrameworkVersion" PropertyName="_TargetFrameworkVersion" />
      <Output TaskParameter="AndroidSdkPath" PropertyName="AndroidSdkDirectory" Condition="'$(AndroidSdkDirectory)'==''" />
      <Output TaskParameter="JavaSdkPath" PropertyName="JavaSdkDirectory" Condition="'$(JavaSdkDirectory)'==''" />
      <Output TaskParameter="MonoAndroidToolsPath" PropertyName="MonoAndroidToolsDirectory" Condition="'$(MonoAndroidToolsDirectory)'==''" />
      <Output TaskParameter="MonoAndroidFrameworkPath" PropertyName="MonoAndroidFrameworkDirectories" Condition="'$(MonoAndroidFrameworkDirectories)'==''" />
    </ResolveSdks>

    <Error Text="Could not locate MonoAndroid SDK." Condition="'$(MonoAndroidToolsDirectory)'=='' Or '$(MonoAndroidFrameworkDirectories)'==''" />
    <Error Text="Could not locate Android SDK." Condition="'$(AndroidSdkDirectory)'==''" />
    <Error Text="Could not locate Java 6 or 7 SDK.  (Download from http://www.oracle.com/technetwork/java/javase/downloads.)" Condition="'$(JavaSdkDirectory)'==''" />

    <!-- ensure a version of paths with trailing slashes even if overridden by /p:foo=bar -->
    <CreateProperty Value="$(MonoAndroidToolsDirectory)">
      <Output TaskParameter="Value" PropertyName="_MonoAndroidToolsDirectory"/>
    </CreateProperty>
    <CreateProperty Value="$(_MonoAndroidToolsDirectory)\">
      <Output TaskParameter="Value" PropertyName="_MonoAndroidToolsDirectory"
        Condition="!HasTrailingSlash('$(_MonoAndroidToolsDirectory)')" />
    </CreateProperty>

    <CreateProperty Value="$(AndroidSdkDirectory)">
      <Output TaskParameter="Value" PropertyName="_AndroidSdkDirectory"/>
    </CreateProperty>
    <CreateProperty Value="$(_AndroidSdkDirectory)\">
      <Output TaskParameter="Value" PropertyName="_AndroidSdkDirectory"
        Condition="!HasTrailingSlash('$(_AndroidSdkDirectory)')" />
    </CreateProperty>

    <CreateProperty Value="$(JavaSdkDirectory)">
      <Output TaskParameter="Value" PropertyName="_JavaSdkDirectory"/>
    </CreateProperty>
    <CreateProperty Value="$(_JavaSdkDirectory)\">
      <Output TaskParameter="Value" PropertyName="_JavaSdkDirectory"
        Condition="!HasTrailingSlash('$(_JavaSdkDirectory)')" />
    </CreateProperty>

    <CreateProperty Value="$(MonoAndroidFrameworkDirectories)">
      <Output TaskParameter="Value" PropertyName="_MonoAndroidFrameworkDirectories"/>
    </CreateProperty>

    <Message Text="MonoAndroid Tools: $(_MonoAndroidToolsDirectory)"/>
    <Message Text="MonoAndroid Framework: $(_MonoAndroidFrameworkDirectories)"/>
    <Message Text="Android SDK: $(_AndroidSdkDirectory)"/>
    <Message Text="Java SDK: $(_JavaSdkDirectory)"/>
    <Message Text="Android Platform API level: $(_AndroidApiLevel)"/>
    <Message Text="TargetFrameworkVersion: $(_TargetFrameworkVersion)"/>


    <!-- Misc paths -->
    <CreateProperty Value="$(_AndroidSdkDirectory)tools\">
      <Output TaskParameter="Value" PropertyName="_AndroidToolsDirectory"/>
    </CreateProperty>

    <CreateProperty Value="$(_AndroidSdkDirectory)platform-tools\">
      <Output TaskParameter="Value" PropertyName="_AndroidPlatformToolsDirectory"/>
    </CreateProperty>
  </Target>

<!-- This target is copied from Common.targets -->
<!-- We want to call ResolveAssemblyReferences to resolve our references, 
     but if we call the real one now, it won't run again when it's normally
     supposed to, so we run a copy of it here instead. -->
<Target Name="_AndroidResolveAssemblyReferencesBinding" DependsOnTargets="GetFrameworkPaths">
  <CreateItem Include="@(Reference)" Exclude="$(AdditionalExplicitAssemblyReferences)">
    <Output TaskParameter="Include" ItemName="_AndroidReference"/>
  </CreateItem>

  <CreateItem Include="$(AdditionalExplicitAssemblyReferences)">
    <Output TaskParameter="Include" ItemName="_AndroidReference"/>
  </CreateItem>

  <ResolveAssemblyReference
  Assemblies="@(_AndroidReference)"
  AssemblyFiles="@(ChildProjectReferences)"
  SearchPaths="$(AssemblySearchPaths)"
  CandidateAssemblyFiles="@(Content);@(None)"
  TargetFrameworkDirectories="$(TargetFrameworkDirectory)"
  AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
  AllowedRelatedFileExtensions="$(AllowedReferenceRelatedFileExtensions)"
  FindDependencies="true"
  FindSatellites="true"
  FindRelatedFiles="true"
  TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
  TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
  TargetFrameworkVersion="$(_TargetFrameworkVersion)"
>
    <Output TaskParameter="ResolvedFiles" ItemName="_AndroidResolvedFiles"/>
    <Output TaskParameter="ResolvedFiles" ItemName="_AndroidReferencePath"/>
    <Output TaskParameter="ResolvedDependencyFiles" ItemName="_AndroidResolvedDependencyFiles"/>
    <Output TaskParameter="RelatedFiles" ItemName="_AndroidReferenceRelatedPaths"/>
    <Output TaskParameter="SatelliteFiles" ItemName="_AndroidReferenceSatellitePaths"/>
    <Output TaskParameter="CopyLocalFiles" ItemName="_AndroidReferenceCopyLocalPaths"/>
  </ResolveAssemblyReference>
</Target>


  <Target Name="ExportJarToXml"
          DependsOnTargets="_ResolveMonoAndroidSdks;_AndroidResolveAssemblyReferencesBinding"
          Inputs="@(EmbeddedJar);@(EmbeddedReferenceJar);@(InputJar);@(ReferenceJar);$(MSBuildAllProjects)"
          Outputs="$(ApiOutputFile)">

    <CreateTemporaryDirectory>
      <Output TaskParameter="TemporaryDirectory" PropertyName="Jar2XmlIntermediateOutputPath" />
    </CreateTemporaryDirectory>

    <!-- Build reference projects, in case they changed -->
    <MSBuild Projects="@(ProjectReference)" Targets="Build">
      <Output TaskParameter="TargetOutputs" ItemName="ResolvedLibraryOutputs" />
    </MSBuild>

    <ResolveLibraryProjectImports
      Assemblies="@(_AndroidReferencePath)"
      OutputDirectory="$(Jar2XmlIntermediateOutputPath)"
      OutputImportDirectory="$(Jar2XmlIntermediateOutputPath)__library_projects__\">
      <Output TaskParameter="Jars" PropertyName="ZippedLibraryProjectJars" />
    </ResolveLibraryProjectImports>

    <CreateItem Include="$(ZippedLibraryProjectJars)">
      <Output TaskParameter="Include" ItemName="ReferenceJar" />
    </CreateItem>

    <!-- Extract the API from the .jar file and store as .xml -->
    <JarToXml
      JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
      JavaOptions="$(JavaOptions)"
      AndroidSdkDirectory="$(_AndroidSdkDirectory)"
      MonoAndroidToolsDirectory="$(MonoAndroidToolsDirectory)"
      JavaSdkDirectory="$(_JavaSdkDirectory)"
      AndroidApiLevel="$(_AndroidApiLevel)"
      OutputFile="$(ApiOutputFile)"
      SourceJars="@(EmbeddedJar);@(InputJar)"
      ReferenceJars="@(EmbeddedReferenceJar);@(ReferenceJar)"
      DroidDocPaths="$(DroidDocPaths)"
      JavaDocPaths="$(JavaDocPaths)"
      LibraryProjectJars="$(IntermediateOutputPath)__library_projects__\*.jar"
    />

    <!-- Delete our temporary directory -->
    <RemoveDirFixed Directories="$(Jar2XmlIntermediateOutputPath)" />

  </Target>

  <Target Name="GenerateBindings"
          DependsOnTargets="ExportJarToXml;_ResolveMonoAndroidSdks;ResolveReferences"
          Inputs="$(ApiOutputFile);@(TransformFile);@(_ResolveAssemblyReferenceResolvedFiles);$(MSBuildAllProjects)"
          Outputs="$(_GeneratorStampFile)">

    <!-- Delete previous generated files if they still exist -->
    <RemoveDirFixed Directories="$(GeneratedOutputPath)" Condition="Exists ('$(GeneratedOutputPath)')" />

    <!-- MSBuild and xbuild call these different things, grab both -->
    <CreateItem Include="@(_ResolveAssemblyReferenceResolvedFiles);@(ResolvedFiles)">
      <Output TaskParameter="Include" ItemName="_ReferencedManagedLibraries"/>
    </CreateItem>

    <!-- Create the .cs binding source files -->
    <BindingsGenerator
      OutputDirectory="$(GeneratedOutputPath)src"
      EnumDirectory="$(GeneratedOutputPath)enums"
      EnumMetadataDirectory="$(GeneratedOutputPath)metadata"
      AndroidApiLevel="$(_AndroidApiLevel)"
      ApiXmlInput="$(ApiOutputFile)"
      AssemblyName="$(AssemblyName)"
      TransformFiles="@(TransformFile)"
      ReferencedManagedLibraries="@(_ReferencedManagedLibraries)"
      MonoAndroidToolsDirectory="$(_MonoAndroidToolsDirectory)"
      MonoAndroidFrameworkDirectories="$(MonoAndroidFrameworkDirectories)"
    />

    <!-- Write a flag so we won't redo this target if nothing changed -->
    <Touch Files="$(_GeneratorStampFile)" AlwaysCreate="true" />

  </Target>

  <Target Name="AddBindingsToCompile" DependsOnTargets="GenerateBindings">
    <!-- Add the files to list of things to be compiled -->
    <CreateItem Include="$(IntermediateOutputPath)generated\*\*.cs">
      <Output TaskParameter="Include" ItemName="Compile" />
    </CreateItem>
  </Target>

  <Target Name="AddEmbeddedJarsAsResources" DependsOnTargets="GenerateBindings">
    <CreateItem Include="@(EmbeddedJar)">
      <Output TaskParameter="Include" ItemName="EmbeddedResource" />
    </CreateItem>
  </Target>

  <Target Name="AddEmbeddedReferenceJarsAsResources" DependsOnTargets="GenerateBindings">
    <CreateItem Include="@(EmbeddedReferenceJar)"
                AdditionalMetadata="LogicalName=__reference__%(FileName)%(Extension)">
      <Output TaskParameter="Include" ItemName="EmbeddedResource" />
    </CreateItem>
  </Target>

  <Target Name="AddLibraryProjectsToCompile" DependsOnTargets="ResolveLibraryProjects">
    <CreateItem Include="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip"
        Condition="Exists ('$(IntermediateOutputPath)__AndroidLibraryProjects__.zip')"
        AdditionalMetadata="LogicalName=__AndroidLibraryProjects__.zip">
      <Output TaskParameter="Include" ItemName="EmbeddedResource" />
    </CreateItem>
  </Target>

  <Target Name="ResolveLibraryProjects"
      Inputs="@(LibraryProjectProperties);@(LibraryProjectZip)"
      Outputs="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip">
    <CreateLibraryResourceArchive
      OutputDirectory="$(IntermediateOutputPath)library_project_imports"
      OutputJarsDirectory="$(IntermediateOutputPath)library_project_jars"
      LibraryProjectPropertiesFiles="@(LibraryProjectProperties)"
      LibraryProjectZipFiles="@(LibraryProjectZip)" />
  </Target>

  <Target Name="AddLibraryJarsToBind" DependsOnTargets="ResolveLibraryProjects">
    <CreateItem Include="$(IntermediateOutputPath)library_project_jars\\*.jar">
      <Output TaskParameter="Include" ItemName="InputJar" />
    </CreateItem>
  </Target>

  <Target Name="CleanBindingsOutput">

    <Delete Files="$(ApiOutputFile)" />
    <Delete Files="$(_GeneratorStampFile)" />

    <RemoveDirFixed Directories="$(GeneratedOutputPath)" Condition="Exists ('$(GeneratedOutputPath)')" />

  </Target>

  <Target Name="CleanLibraryProjectIntermediaries">
    <Delete Files="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip" />
    <RemoveDirFixed Directories="$(IntermediateOutputPath)library_project_jars" Condition="Exists ('$(IntermediateOutputPath)library_project_jars')" />
    <RemoveDirFixed Directories="$(IntermediateOutputPath)library_project_imports" Condition="Exists ('$(IntermediateOutputPath)library_project_imports')" />
  </Target>

  <Target Name="_CreateNativeLibraryArchive"
          Condition="@(EmbeddedNativeLibrary) != ''" 
          Inputs="@(EmbeddedNativeLibrary)"
          Outputs="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip">
    <CreateNativeLibraryArchive
      OutputDirectory="$(IntermediateOutputPath)native_library_imports"
      EmbeddedNativeLibraries="@(EmbeddedNativeLibrary)" />
  </Target>

  <Target Name="_AddNativeLibraryArchiveToCompile" DependsOnTargets="_CreateNativeLibraryArchive">
    <CreateItem Include="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip"
                Condition="Exists ('$(IntermediateOutputPath)__AndroidNativeLibraries__.zip')"
                AdditionalMetadata="LogicalName=__AndroidNativeLibraries__.zip">
      <Output TaskParameter="Include" ItemName="EmbeddedResource" />
    </CreateItem>
  </Target>

</Project>
4

0 回答 0