• I have used the command
xamarin-component.exe package C:\cmp\AndroidComponent\component
for creating Xamarin component.While building the Sample android project, it is showing the below error. (I have used the command xamarin-component.exe package C:\cmp\AndroidComponent\component -verbose to display the error message in detail).
Error message:
C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets(155,2):
error MSB3644: The reference assemblies for framework
"MonoAndroid,Version=v1.0" were not found. To resolve this, install
the SDK or Targeting Pack for this framework version or retarget your
application to a version of the framework for which you have the SDK
or Targeting Pack installed. Note that assemblies will be resolved
from the Global Assembly Cache (GAC) and will be used in place of
reference assemblies. Therefore your assembly may not be correctly
targeted for the framework you intend.
[C:\cmp\AndroidComponent\component\samples\App17\VidyoClientAndroid\VidyoClientAndroid.csproj]
Note:
I am able to create a Xamarin component for iOS source code successfully.
• While creating the Xamarin component for Android source code, internally msbuild.exe is getting called from 64 bit folder(C:\Program Files (x86)\MSBuild\14.0\bin**amd64**\msbuild.exe "/p:Configuration=Release" "C:\cmp\AndroidComponent\component\samples\App17\App17.sln"...).
• Build is successful when msbuild.exe is called from path: “C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe”(32 bit) explicitly while building the android project explicity.
We ran into the same issue; you were close to the right answer, and the forums had the correct one.
First lets look at the portion of code that is erroring (Xamarin.Android.Common.targets; in the newer versions of Xamarin this code is much further down):
<Target Name="_GetReferenceAssemblyPaths">
<GetReferenceAssemblyPaths
TargetFrameworkMoniker="$(TargetFrameworkIdentifier),Version=v1.0"
RootPath="$(TargetFrameworkRootPath)">
<Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_XATargetFrameworkDirectories" />
</GetReferenceAssemblyPaths>
The most important part here is the
$(TargetFrameworkRootPath)
When NuGet is ran via the command line we see that it is using the 64bit MSBuild Executable:
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
(You correctly identified this yourself above) but just to be clear for anyone following along.
When you use the 64bit version of MSBuild $(TargetFrameworkRootPath) gets defined as C:\Program Files\Reference Assemblies\Microsoft\Framework However Xamarin does not install any of the Framework Utilities to that directory; instead everything lives in the x86 version here C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework
When you read online a ton of people get this problem solved by installing Visual Studio 2017; but that is a red-herring it only works because it causes NuGet to use MSBuild 15 which ships with Visual Studio 2017 which apparently is not affected by this bug.
There are a few ways to fix this issue:
Tell NuGet to use the x86 MSBuild when you Restore using the optional -MSBuildPath argument as described here How Can I Tell NuGet What MSBuild Executable to Use?
Upgrade to Visual Studio 2017 to get MSBuild 15
Define $(TargetFrameworkRootPath) to be C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework; this can be done however you please, the biggest hammer is to set it as an environment variable in the environment prior to execution. Note this will probably cause a bunch of unintended side-affects if you're not careful. <- DON'T DO THIS, Even as suggested in the forms.
Related
I have a build definition set up in our on-prem TFS 2018 instance and it's just not working for us.
We have Visual Studio 2017 Enterprise installed on the TFS server instance, including Xamarin Studio, pointing to the default /program files (86)/android/android-sdk location, and we've created two (2) environment variables on the Server, called AndroidSDK and Xamarin.Android, yet we're still getting a build failure:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets (617, 2)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(617,2): Error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.
Process 'msbuild.exe' exited with code '1'.
We've tried setting /p:{} as an Additional parameter in the Android build step, but this also fails unexpectedly.
Are we missing something here? Any help would really be appreciated.
Note we're trying out on-premise for our team
This issue is most likely due to one or both of the following reasons:
Android SDK Tools are removed accidentally (or Antivirus has removed
these tools)
Android SDK Platform-tools are removed accidentally (or Antivirus
has removed these tools)
In case of this issue, SDK manager will not work. And the options to
run SDK Manager within Visual Studio will also be disabled. On the
Android SDK installation path one or both of the following folders
will be missing:
tools
platform-tools
So, you just need to reinstall the Tools. Please refer to Wasim's blog for details.
Besides, in TFS the build agent on the server runs in its own account (build service account), so the Android SDK must be accessible to it. which meant that a local build on the server may worked fine, but the TFS build agent couldn't access it and thus failed. In this case, you can move the SDK to an accessible place for the build agent service account, thus everything will be worked.
Refer to this link for details :
Resolving “The Android SDK Directory could not be found” building a Xamarin app via TFS build server
I'm on windows7 x64, installed today's latest stable release of android sdk studio (through android studio bundle, since it's shipped together now apparently). I have properly configured the environment variables as you'll see above.
This is what I get when issuing the following command
$ cordova build android
ANDROID_HOME=G:\installs\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: G:\installs\Android\sdk\tools\templates\gradle\wrapper
And indeed, the "templates" directory doesn't even exist in my sdk install.
I've already tried the suggestions (setting the right path, uninstall/reinstall) of this question here but nothing applies to my case, and I find that manually copying and pasting packages is not really a solution, since there's a package manager in place.
If anybody has an answer as of today's android install, would be very much appreciated.
If still not working then copy all file from gradle\wrapper from Android Studio installation folder
C:\Program Files\Android\Android
Studio\plugins\android\lib\templates\gradle\wrapper
and paste it in your Android SDK gradle\wrapper then run same command.
E:\android-sdk\tools\templates\gradle\wrapper
This is a known issue; see CB-12544. For now you'll need to downgrade.
I downloaded Android SDK r25 manually and placed templates folder inside Android/sdk/tools. This solved the issue for me.
You can get it from https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
For Windows:
https://developer.android.com/studio/index.html
Go to the section :"Get just the command line tools"
There is a link 'sdk-tools-darwin-3859397.zip' for Mac, Unfortunately that didn't have the templates folder with Gradle Wrapper. So for Mac users, i will suggest not to go for this zip.
This question already has an answer here:
"aapt.exe" exited with code -1073741819
(1 answer)
Closed 6 years ago.
I've installed VS 2015 community with Xamarin. I can't build a new android project even I didn't add any thing ,simply it is new project.
the error message as shown in photo.
did lots of search but still couldn't figure out what leads to this error.
-there are some answer for this question before which I've gone through them and they don't work to fix this issue.
any help is appreciated.The Error List in VS 2015
aapt.exe can crash if any of your images or other resource contains "-" or " ". To avoid crash remove those symbols. See more details see this question on Xamarin forums: Build fails on Android projects - "appt.exe" exited with code 1073741816
If that does not help you may need to reinstall Visual Studio and Xamarin:
“aapt.exe” exited with code -1073741819
FYI: "aapt" is Android Asset Packaging Tool.
Increase your MSBuild output verbosity in order to get more details on what is causing the failure:
MSBuild project build output verbosity to Diagnostic
Tools -> Options -> Projects and Solutions -> Build And Run then find where it says MSBuild project build output verbosity (on Visual Studio 2015 that’s a dropdown) and change it from Minimal to Normal or Diagnostic if it isn’t set to that option already.
Clean and Rebuild your app and review the contents of Build Output window.
Note: Usually aapt errors revolve around resources with "bad names", spaces, invalid characters, etc...
Note: SDK Build Tools 21.0.x has some bugs with aapt, open your Android SDK Manager and make sure that you have the latest installed:
In my case, I have the latest 23 installed (plus a few older versions required for some Android Studio projects).
If you need to change which version Android SDK build-tools is being used to avoid SDK bugs/issues on various Windows OS versions, you can set the AndroidSdkBuildToolsVersion MSBuild Property.
AndroidSdkBuildToolsVersion
The Android SDK build-tools package provides the aapt and zipalign tools, among others. Multiple different versions of the build-tools package may be installed simultaneously.
~~~
default value may be overridden within youur project file to choose an alternate build-tools version, if (for example) the latest aapt is crashing out while a previous aapt version is known to work.
Ref: https://developer.xamarin.com/guides/android/under_the_hood/build_process/
The issue solved after I tried many things but the one which work with me is that
1.Uninstall Android SDK.
2.Manually remove any folders related to Android (Which I haven't done before).
3.Reinstall Android SDK.
thanks for your help.
In the beginning..
I know that this question has been asked way too many times and.. I checked all ansers on SO. Tried every combination and every solution I found but nothing has worked for me so far.
The problem
I've succesfully installed cordova downloading it from the official site and I've been following the Guide.
I've added wp8 platform succesfully first. Then I tried to add android as well.
After executing the command cordova platform add android, I got the following error.
Error: executing command 'ant', make sure you have ant installed and added to your path.
Here's a screenshot with more details:
My efforts
I've installed ANT, the last Java JDK and added all necessary Enviroment Variables to my System.
ANT and JAVA both gets executed fine from any source path.
ant -version outputs
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
java -version outputs
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
Enviroment Variables
I've set up every necessary variable. From ANT_HOME to PATH. Everything is as it should be
ANT_HOME: C:\Program Files\Ant
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_05
ANDROID_HOME: C:\Users\Kevin\Desktop\Cellulare\Development\sdk
PATH: %JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
As everyone can see, I've also added android platform-tools and tools to my PATH. Same thing for Ant and Java (\bin dirs).
Needless to say but every path is correct.
Having this things said, Why this still doesn't work? I've also restarted my PC as well but with no results.
Solution
Thanks to Kerri Shotts.
My problems were from those spaces in my paths.
So I changed C:\Program Files\... to C:\Progra~1\....
IMPORTANT!
I also noticed there were 2 □ characters in my strings. Like this ..\C□□ellulare\... They probably came from a wrong copy-paste format. After fixing these things everything worked!
Due to the nature of languages, whitespaces are executed in some whilst ignored in others.
Utilizing a file name such as "Program(whitespace)Files" does produce errors when compiling from \bin directories.
Next time you declare an environmental variable, be sure that your folder does not contain any whitespaces or gaps between the various names.
FYI: camelCase scripts where introduced tow work around this concept.
Thanks.
Hi I have problem upgrading Phonegap from 2.5.0 to 2.6.0 and 2.7.0 and specifically with step 8. I'm following the steps from the documentation Upgrading Cordova Android
Copy files from bin/templates/cordova to the cordova directory in your project
Where should I put those files, so they could upgrade my project?
The Android Phonegap conversion docs have changed significantly. There's no longer a step by step process that walks through each upgrade requirement. Instead, theres an "update" program that theoretically does the upgrade automatically. It didn't exactly work this way for me. After going through the documented update process (one step now) I had to go through my project and make sure everything was in place - specifically the cordova-2.7.0.jar and the cordova-2.7.0.js files.
I've just finished upgrading an Android project from Phonegap v2.5.0 to Phonegap v2.7.0. The process I followed was:
Back up the Android project.
Execute the Phonegap update command for v2.7.0 as described in the PG upgrade documentation
Change the current directory to Phonegap for Android directory:
$ cd /phonegap-2.7.0/lib/android
Execute the update command:
$ ./bin/update YOUR/CORDOVA/PROJECT/DIR
Ensure that Eclipse is referencing the correct Phonegap library in the libs directory: cordova-2.7.0.jar.
I also deleted the reference to the previous jar file.
Make sure that the phonegap javascript file (cordova-2.7.0.js) is referenced appropriately in the index.html file.
From within Eclipse: Project/Clean
Build the project and test.
I'm also trying to upgrade from 2.5.0 to 2.7.0 and running the update.bat file gave me the following message: Missing one of the following: JDK: java.oracle.com Android SDK: developer.android.com Apache ant: ant.apache.org – Etienne Desgagné May 27 at 2:15"
You need to check your 'path' System Variables in Environment variables under advanced system settings. JDK is the Java Development Kit and you check if it's correct by 'echo %JAVA_HOME% in a terminal. Ant is an apache thing and again you check that's correct by 'echo %ANT_HOME% and then you just need to make sure your Android SDK folder is in the path variable.