Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mono.Android-Tests is failing to build with AndroidGenerateJniMarshalMethods enabled #2683

Closed
pjcollins opened this issue Feb 1, 2019 · 2 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: Unit Tests Issues with repo unit tests.
Milestone

Comments

@pjcollins
Copy link
Member

I'm no longer able to build the Mono.Android-Tests suite against a XA system install, as a result of the changes in #2153.

Steps to Reproduce

  1. On macOS, install a recent .pkg from master.
  2. Get a clean checkout of xamarin-android.
  3. msbuild /t:SignAndroidPackage src/Mono.Android/Test/Mono.Android-Tests.csproj
  4. The build fails on the _CreateJavaInteropDllConfigs target because I don't have XA build artifacts in my checkout:
(_CreateJavaInteropDllConfigs target) -> 
  /Users/peter/source/xamarin-android/build-tools/scripts/JavaInteropDllConfigs.targets(11,5): error MSB3491: Could not write lines to file "/Users/peter/source/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Java.Interop.dll.config". Could not find a part of the path "/Users/peter/source/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Java.Interop.dll.config". [/Users/peter/source/xamarin-android/src/Mono.Android/Test/Mono.Android-Tests.csproj]

Now, I can conditionally set /p:XAInstallPrefix=/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/ on macOS, but msbuild then runs into a permission issue when trying to modify the file:

(_CreateJavaInteropDllConfigs target) -> 
  /Users/peter/source/xamarin-android/build-tools/scripts/JavaInteropDllConfigs.targets(11,5): error MSB3491: Could not write lines to file "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild/Xamarin/Android/Java.Interop.dll.config". Access to the path "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild/Xamarin/Android/Java.Interop.dll.config" is denied. [/Users/peter/source/xamarin-android/src/Mono.Android/Test/Mono.Android-Tests.csproj]

Finally, the _CreateJavaInteropDllConfigs target can't work on Windows as designed (though I don't believe any of this is yet supported on Windows anyway) because xbuild doesn't exist in the XA install path on Windows. The relevant assemblies and configuration files would be found in a path similar to the one shown below:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Java.Interop.dll

Log File

https://gist.githubusercontent.com/pjcollins/31101a7f7b4badeaec79bac976d47533/raw/9633a1077e8865c80d606b061a4122a53438e242/gistfile1.txt

@pjcollins pjcollins added Area: App+Library Build Issues when building Library projects or Application projects. Area: Unit Tests Issues with repo unit tests. labels Feb 1, 2019
@jonathanpeppers
Copy link
Member

@grendello was seeing a similar problem when building the XF integration project in Release mode, when you've only built XA in Debug mode:

build-tools/scripts/JavaInteropDllConfigs.targets(11,5): error MSB3491:
    Could not write lines to file "bin/Release/lib/xamarin.android/xbuild/Xamarin/Android/Java.Interop.dll.config". Could not find a part of the path "bin/Release/lib/xamarin.android/xbuild/Xamarin/Android/Java.Interop.dll.config".

So if you have a clean checkout:

  • make prepare all
  • bin/Debug/bin/xabuild tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj /bl /restore /p:Configuration=Release

@jonathanpeppers jonathanpeppers added this to the d16-1 milestone Feb 5, 2019
@pjcollins pjcollins modified the milestones: d16-1, d16-3 Jun 7, 2019
@pjcollins pjcollins assigned pjcollins and unassigned radekdoulik Jun 7, 2019
@pjcollins
Copy link
Member Author

Should be fixed by #3042.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: Unit Tests Issues with repo unit tests.
Projects
None yet
Development

No branches or pull requests

3 participants