The "GradleBuild" task failed unexpectedly - android

I have VS2010 with nvidia CodeWorks for android, updated with the latest version. My project built fine on ant, but after switching to gradle the following error occurs:
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: The "GradleBuild" task failed unexpectedly.
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: System.InvalidOperationException: Sequence contains no elements
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.GradleBuild.GetLatestBuildToolsVersion()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.GradleBuild.WriteBuildFile(AndroidManifest manifest)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.Tasks.Android.AndroidBuildBase`1.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.TrackedToolTask.Nvidia.PentaK.Build.MSBuildInterop.ITrackedToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.Impl.TrackedToolTaskWrapper`1.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.Utilities.ToolTask.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Nvidia.PentaK.Build.MSBuildInterop.ToolTaskBase`2.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android\Nvidia.AndroidBuild.targets(265,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext()
5>
I'm not sure what went wrong here- does it fail to find tools (environment variables look correct), or cannot find manifest (same as for ant build, which worked). Tried to reinstall codeworks, but error remains the same. Probably I'm missing some paths or environment variable, but no idea which ones.
The latest CodeWorks have the following components:
android-ndk-r10e
android-sdk-windows
apache-ant-1.8.2
gradle-2.2.1
jdk1.7.0_71

So it seems I can answer that myself...
CodeWorks for Android 1R3 installs the latest version of android build tools into NVPACK\android-sdk-windows\build-tools\android-6.0 folder, where VS tegra plugin cannot find it. (VS tegra plugin was also installed by CodeWorks for Android 1R3, so I was expecting some compatibility between components of same package.) Installing any other build tool version with Android SDK manager (located in NVPACK\android-sdk-windows) solves the issue. Renaming android-6.0 folder to anything like version number x.x.x (i. e. 23.0.2) also works.

Related

aapt2.exe link does not find assets

I've been trying to use aapt2.exe to build Android assets, but it is not working.
The command I'm using is:
&"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\aapt2.exe" link --manifest AndroidManifest.xml --proto-format --output-to-dir --custom-package com.infinitespacestudios.legacyinstalltimeexample.assetsfeature -A Assets -o obj\Debug\netstandard2.0\feature
However, it generates the error:
error: failed to write assets/Hello.json to archive: M├ñ├ñritetty├ñ tiedostoa ei l├Âydy. (2).
The end of the error message is garbled Finnish, which says "The specified file is not found."
It generates this error regardless of the directory specified with -A. Could it possibly be because I have Finnish operation system?
I tried also running the executable as an administrator, but it did not help.

The "ConvertResourcesCases" task failed unexpectedly. Xamarin Android build

When I build my Xamarin Android app with Visual Studio 2017 for Mac(7.7.4 build 1), Mono JIT compiler version 5.18.0.248 (2018-08/a4956c837e1 Fri Jan 25 16:13:12 EST 2019) I get the following exceptions:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.Recipes.Droid/obj/Debug/lp/35/jl/res/values-ca/values-ca.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp565e9644.tmp". File already exists.
/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.ServerAnnouncement.Droid/obj/Debug/lp/15/jl/res/layout/notification_template_icon_group.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp4d4475a7.tmp". File already exists.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784
If I click on Build (NOT Rebuild) those exceptions get less every time I build until it finally builds successfully.
If I use jetbrains Rider, the build works every single time.
I gave full permissions (r/w) to everyone on the directories mentioned in the exception and I still get the error. I use APFS case-insensitive.
I would be very grateful for any pointer to solve this.
Thank you very much Leon Lu from Microsoft for pointing me in the right direction. The error stems from a condition in parallel building xamarin android. When parallel builds are disabled, the outcome is the same each time. Parallel builds can be disabled in the Preferences of Visual Studio 2017 for Mac (see attached image).
The issue seems to be fixed (see GitHub link in Leon Lu's comment) and be rolling out in one of the future updates.

Failed to load C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.1\lib\dx.jar

When I try to run my Android project on Eclipse, these errors appear :
[2019-01-28 14:02:47 - Dex Loader] Failed to load C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.1\lib\dx.jar
[2019-01-28 14:02:47 - RallisCensus] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
Please help to resolve issue.
Android SDK Manager

When I use android studio ndkBuild to budild the c++, arm-linux-androideabi-g++: error No such file or directory

When I use android studio ndkBuild to budild the c++ code, I got error that can't find the static library:
arm-linux-androideabi-g++: error: E:WorkSpaceAndroid_AvatarAvatarmobilesrcmaincpp/prebuild/TTS/ThirdParty/TextAnalysis/armeabi-v7a/lib/libTextAnalysisMain.a: No such file or directory
arm-linux-androideabi-g++: error: E:WorkSpaceAndroid_AvatarAvatarmobilesrcmaincpp/prebuild/TTS/ThirdParty/boost_1_53_0/armeabi-v7a/lib/libboost_regex-gcc-mt-1_53.a: No such file or directory
arm-linux-androideabi-g++: error: E:WorkSpaceAndroid_AvatarAvatarmobilesrcmaincpp/prebuild/TTS/ThirdParty/openfst_1_3_3/armeabi-v7a/lib/libopenfst.a: No such file or directory
arm-linux-androideabi-g++: error: E:WorkSpaceAndroid_AvatarAvatarmobilesrcmaincpp/prebuild/TTS/ThirdParty/Ne10/lib/libNE10.fPIC.a: No such file or directory
The slash of the path of the static library disappeared like
E:WorkSpaceAndroid_AvatarAvatarmobilesrcmaincpp/
This got error 'No such file or directory', the original path is
E:\WorkSpace\Android_Avatar\Avatar\mobile\src\main\cpp\/prebuild
Did anyone encounter this problem?

Adding assets to Android Project, Visual Studio 2015 CTP

I am attempting to add assets to an android project, using Visual Studio 2015 CTP. When I add files to ProjectName.Packaging/res the build fails with the error:
1> -package-resources:
1> [aapt] Found Deleted Target File
1> [aapt] Creating full resource package...
1> [aapt] invalid resource directory name: C:\ProjectName\ARM\Release\Package\res image.png
1>
1> BUILD FAILED
1> C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:932: The following error occurred while executing this line:
1> C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:950: null returned: 1
1>
1> Total time: 0 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\AndroidPackaging\Android.Common.targets(280,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3\\bin\ant.bat" debug -Dout.final.file="C:\ProjectName\ARM\Release\ProjectName.Packaging.apk"" exited with code 1.
Please advise. Thanks.
Ok, I was able to answer my question. Right click ProjectName.Packages -> Add -> New Folder and name it assets. Right click assets -> Add -> Existing Item -> select the asset you wish to add.
If the error persists, clean project AND manually delete the build folder from C:\ProjectName\ARM\Release or whatever. Rebuild.
The file name of your resources can't contain spaces, use a _ instead

Categories

Resources