Visual Studio build failure after adding com.phonegap.plugins.facebookconnect - phonegap-plugins

I have reproduced this issue on both VS2013 & VS2015. Both are up to date with all the updates.
Steps to reproduce the problem:
Create a new Blank App (Apache Cordova) project.
Do a build and notice it all works fine.
Add this manually or by using the config tool.
Do a build and notice nothing happens. I get the error below.
I'm not sure why this is happening since no information is given to me in the error below. Any ideas on how I could get more details about the error? Or, has anyone come across this issue and fixed it? If so, how?
1>------ Build started: Project: Twelve, Configuration: Debug Android ------
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(96,5): warning : The TypeScript Compiler was given no files for compilation, so it will skip compiling.
1> GeneratedJavascript=
1> D:\Documents\Visual Studio 2013\Projects\Mobile\Twelve\Twelve>call "C:\Program Files (x86)\nodejs\"\nodevars.bat
1> Your environment has been set up for using Node.js 0.10.33 (ia32) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\aulzf2r2.xwq\packages\vs-mda
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

Sorry, I cannot add this as a comment but go to Tools > Options > Projects and Solutions > Build and Run and set MSBuild project build output verbosity to Detailed or Diagnostic. You should be able to see the error.
I have just installed the same plugin 0.11.0 and I am getting the following error.
3> TypeError: Cannot use 'in' operator to search for 'APP_ID' in undefined (TaskId:22)
3>Done executing task "MdaVsCli" -- FAILED. (TaskId:22)
3>Done building target "BuildMDA" in project "XXXX.jsproj" -- FAILED.: (TargetId:14)
I have the APP_ID defined as the plugin page mentions and configured it like it is mentioned on MSDN page for Manage Plugins for Apps Built with Visual Studio Tools for Apache Cordova but nothing seemed to help.
Still trying to find my problem out about it but I hope this helps with your problem.

Unfortunately, due to a Cordova issue, you can run into problems with plugin variables in Cordova < 5.0.0. Plugin variable information is lost if you install the "plugin" be fore the "platform" which can happen depending on your workflow. They do, however, function in Cordova 5.0.0 which you can use with VS 2015 RC. To update to 5.0.0 and use plugin variables, you will need to update your VS project and use the command line.
Remove the plugins with the variables via the config designer.
Update to Cordova 5.0.0 via the config designer (Platforms > Cordova CLI)
From the command line:
Go to your project directory.
Type the following substituting the plugin name for the plugin you wish to add:
npm install -g cordova
cordova plugin add nl.x-services.plugins.launchmyapp --variable URL_SCHEME=myscheme
This issue is actively being worked so things should improve in the future. You will also want to take note of the additional known issues pertaining to 5.0.0 when using it.
https://www.visualstudio.com/explore/cordova-known-issues-vs
You will also want to note the bug reported for the Facebook for the Cordova plugin registry when building for iOS. This will also likely cause issues with VS due to the NTFS file-system on Windows. Here's a possible fix for this problem:https://github.com/Chuxel/taco-tricks/tree/master/ios-plugin-symlink-fix

Related

Sync ends with BUILD SUCCESSFUL but Make Project FAILS

All SO post on this subject (except for an unanswered one) describe the exact opposite situation: Build successful but Sync fails.
My situation is that I installed Android Studio for the first time (2021.3.1.17) and successfully imported an old (but working) Eclipse/ADT project of mine: Sync completes successfully, albeit with several warnings:
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
It also warns about the Java version:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in C:\Program Files\Java\jdk1.8.0_341\jre
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Gradle settings
But when I try to Build > Make Project, it surprisingly ends with an ERROR:
Build file 'C:\Users\WebViewer\StudioProjects\MyApp\billing\build.gradle' line: 1
A problem occurred evaluating project ':billing'.
> Failed to apply plugin 'com.android.internal.library'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in C:\Program Files\Java\jdk1.8.0_341\jre
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
I understand the warnings (definitely good ones, prompting to update to current versions, and I eliminated the Java version one via File > Settings > Build Tools > Gradle) but... if Sync ends successfully, why would Make Project fail completely?
As a newcomer to Android Studio (IntelliJ + Gradle), I am confused by this discrepancy. Could someone please shed light on the essential difference between Sync, Make Project and Rebuild Project?

Could not find com.android.tools.build:gradle:7.5.1

So I was building out a test APK in Android Studio tonight that had to be signed. It failed and said my Gradle was out of date. So I upgraded my gradle from 7.3.3 to the newest 7.5.1
I changed the wrapper setting to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
and then I changed my build.gradle dependency to classpath 'com.android.tools.build:gradle:7.5.1'
Note that after doing the changes, and restarting Android Studio, it did upgrade the version in the app directory.
Here's the error getting thrown below:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
Required by:
project :
Note that this was a project from a client, and I did not write this originally. These dependencies were in place, but fairly recent, and the app would build fine with it using 7.3.3. However it wouldn't let me sign my app.
I suppose I could use some wisdom on both of these issues. What I'm going to do is go back to version 7.3.3, build the signed APK again, and copy that exact error to report back here with. It was a gradle version error.
For any any Flutter noobs like myself passing through, this error occured because the Android Tools Plugin version DOES NOT match the Gradle Version:
https://developer.android.com/studio/releases/gradle-plugin#groovy
They match up just vaguely enough in number, that you would think that my line com.android.tools.build:gradle:7.5.1. uses gradle 7.5.1, but instead, Android Tools for Gradle is actually a separate entity, and at 7.3.3 as of typing this reply.
So you CAN set your Gradle to the newest version somewhere else in your project, but it has to match the compatible Android Tools version, which is set here. Its silly and confusing at first, and can easily trip up newcomers. Hopefully the versions diverge enough, or the code syntax changes for some better clarity, but as of now, this is it.

NPM error (System.ComponentModel.Win32Exception) in Visual Studio 2015

I need to get started coding an Angular 2 application at my workplace but I get the following error in VS:
====Executing command 'npm install'====
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Microsoft.VisualStudioTools.Project.ProcessOutput..ctor(Process process, Redirector redirector)
Error executing npm - unable to start the npm process
Error - Cannot load global packages.
I've followed Angular 2 VS 2015 QuickStart guide, located here:
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
Prerequisites are all installed:
VS 2015 with Update 3
nodeJS v.6.9.1
TypeScript v.2.0.6.0
This error shows up in the output when I open the project or try to do a 'restore packages'
Thanks.
It looks like you need other version of Node. You have maybe too new version of Node I guess. According to this thread: https://github.com/Microsoft/nodejstools/issues/476
you should downgrade and configure VS:
It looks like vs2015 does not work with the latest 5.0.0 Node. Replacing with 4.2.2 one solves this issue for me. To make Visual Stuido use the same Node and npm as cmd by changing some files including node.exe under following folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External
Look for this article also http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/
I finally found out the reason.. nodeJS was installed with the x86 installer on a x64 computer. Installed nodeJS in 64 bit and it resolved my issue.
Hope this help anyone who has this error.

Getting Build Error for Cordova plugin integration on Visual Studio 2015 TACo

This is regarding Cordova based universal app development using Visual Studio 2015 - Tools for Apache Cordova (TACo).
Here is the sample code which I am trying to run: AngularJSToDo app. In this app, there is GeoLocation Cordova plugin is being used. In config.xml:
<vs:plugin name="org.apache.cordova.geolocation" version="0.3.10" />
While building application for Windows Phone Emulator 8.1, it throws an error after below process:
------ Adding plugin: cordova-plugin-geolocation#2.2.0
1> Calling plugman.fetch on plugin "cordova-plugin-geolocation#2.2.0"
1> Fetching plugin "cordova-plugin-geolocation#2.2.0" via plugin registry
1>MDAVSCLI : error : read ECONNRESET
This error appears after a long time fetching event. I have already tried installing particular plugin using "npm" command through command prompt, but VS build automatically clears older plugins and re-download and install latest ones.
In error section, it says
"read ECONNRESET"
Please guide me what should be done to resolve this error from Visual Studio build.
Reference: https://taco.visualstudio.com/en-us/docs/create-a-hosted-app/
Your plugin add is failing because Cordova has closed the Plugin registry and moved to npm. That means all Cordova versions less than 5.x which don't use npm will no longer be able to add plugins.
If you are not on the latest version of TACO, update to make sure that you are on a version that can add a plugin from npm
Then, instructions after updating:
Go to config.xml -> plugins
remove the camera plugin
Add it back in again from the core plugin list
Actually I just ran the sample myself, and had no problem getting it to load on the iOS simulator, but it pulled the plugin from npm and not the plugin registry.
This issue had been resolved by restarting node(npm) server. Below are the steps what I did.
Terminal - Ctrl+C to stop the npm server
Go to particular project folder, and add the plugins using below command
cordova plugin add <plugin-name>
Restart the node server: remotebuild
Hope this helps to others.

LNK1104 error when building node-gyp project in Visual Studio 2015

I've tried everything, I have the proper version of Python (Python27), Windows SDK 8.1 is installed, Visual C++ is also installed, but the build still fails. I'm using Visual Studio 2015 Community editor btw. When I try to execute node-gyp buildfrom cmd I get the following error:
> C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.t
argets(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v14
0') cannot be found. To build using the v140 build tools, either click the Proj
ect menu or right-click the solution, and then select "Update VC++ Projects..."
. Install v140 to build using the v140 build tools. [C:\Users\Programming PC\Do
cuments\GitHub\node-addon-examples\1_hello_world\node_0.10\build\hello.vcxproj]
This error prompted me to go into to Visual Studio and see if the project can at least build and run from there, it doesn't.
Please help I looked at all of the other questions pertaining to this issue but none of their solutions have helped me.
Took a lot of research but I found the solution(s). First, to get rid of the MSB8020 error either add the VisualStudioVersion environment variable and set it to your version of visual studio or execute node-gyp build with this flag /p:VisualStudioVersion=14.0 (In my case).
I actually got different errors after I solved this one and I believe they are well worth mentioning.
Error MSB4175 then showed up, basically indicating that it cannot find Microsoft.Build.Tasks.v12.0.dll (Do a search on this .dll to find out where its usually located), copy and paste it to the path that it's looking for it in.
Now here is the kicker, the last error that interrupts node-gyp is because of a missing .lib file. Npm doesn't create the following file ...\.node-gyp\4.3.1\Debug\node.lib. So you need to go here and download a node.lib and mkdir Debug\ and put node.lib in there.
Afterwards node-gyp should build without errors.

Resources