VS 2015 TACO - build broke on Xcode 8 / iOS 10 - node.js

Here are the issues I encountered and fixed:
Code signing: downloaded the xcode8.js hook and added the following to build.json, per http://www.dpogue.ca/articles/cordova-xcode8.html:
"ios": {
"debug": {
"developmentTeam": "VZ4B5XSP9U"
},
"release": {
"developmentTeam": "VZ4B5XSP9U",
"codeSignIdentity": "iPhone Developer"
}
}
On my Mac, deleted the ~/.taco_home/node_modules/taco-remote-lib/2.2.1 and .../2.2.0 folders, per https://github.com/Microsoft/remotebuild/issues/5.
On my Mac, tried uninstalling and reinstalling remotebuild, and different versions of node and npm (0.12.9 and 4.6, and respective npm versions).
In Visual Studio, tried changing the targeted Cordova version: 6.3.1, 6.2, 6.1.1, and back to 5.4.1.
No matter what I do though, the build gets stuck either on extracted - Extracted app contents from uploaded build request, or building - Updating platform forever.
Earlier, when I tried opening the Xcode project in Xcode on the Mac, it successfully built and deployed the app to the device. I was then facing issues using WebRTC (using cordova-plugin-iosrtc) and it was giving me privacy violation exceptions. I tried adding the cordova-custom-config plugin and appropriate Cocoa keys (NSCameraUsageDescription and NSMicrophoneUsageDescription) per App crashes with __CRASHING_DUE_TO_PRIVACY_VIOLATION__ when trying to access contacts, and then it stopped working altogether.
Can anyone please advise what are the latest versions of all of the components I should be using to make it work again? Some sources advise to use Node 0.12.9 on the Mac, others 0.12.7; most people claim that with Cordova >= 5.3.3, any Node version should suffice, however using Node 4.6 didn't work either.
Thanks in advance for any help!
Update: After performing the brew update etc. as suggested by Jordan, the remote deploy works, but the build sets "Main interface" setting under project's General tab to "NSMainNibFile~ipad", which causes the app to crash on launch, until I open the project in Xcode and clear that field, then an incremental build creates a functioning app.

This is a known issue with Apache Cordova 6.3.1 and for the Visual Studio tools we've been working on a fix for this. To work around the issue for now, you'll need to perform the following steps:
Add a developmentTeam property to the ios build settings in your project's build.json file (an example is shown below).
Set the build.json file's codeSignIdentity property to the static value iPhone Developer.
Setup a before_compile hook in your project to copy the developmentTeam property into the project's platforms/ios/cordova/build.xcconfig file.
The project's build.json file should look something like the following:
{
"ios": {
"debug": {
"developmentTeam": "DEVELOPMENT_TEAM_NAME"
},
"release": {
"developmentTeam": "DEVELOPMENT_TEAM_NAME",
"codeSignIdentity": "iPhone Developer"
}
}
}
To simplify the process, Darryl Pogue published a sample hook that makes the required changes to the project's build.xconfig file based on the build.json example shown above. To use this hook, copy the sample xcode8.js file to your project's hooks folder, and then modify the project's config.xml to execute it before the compilation step using the following code:
<platform name="ios">
<hook type="before_compile" src="hooks/xcode8.js" />
</platform>
Creating a Distribution Build
At this point, the Cordova build process works, and you can run, test and debug your app. Unfortunately, the app isn't being signed with the correct development certificate needed for distribution. In order to sign them with a distribution certificate, you'll need to create an archive of the app by following the instructions found in: Uploading Your App to iTunes Connect.
iOS 10
Developers building Cordova applications for iOS 10 may encounter the following errors:
Http 404: Error mounting developer disk image
Http 500: No devices found to debug. Please ensure that a device is connected and awake and retry.
This is caused by the Mac development environment needing an update to several modules. To fix the issue, on Mac OS, open a terminal window and issue the following command:
brew update && brew upgrade libimobiledevice --HEAD && brew upgrade ios-webkit-debug-proxy ideviceinstaller

Related

Cordova Crosswalk: installation of Andoird-apk failed

I'm using cordova-plugin-crosswalk-webview-v3 to create android app with a build-in browser as standard webview in my app.
Cordova can create very simple a android app without any problem. As I added crosswalk (latest version) in cordova, my export are in 2 versions: arm64 and x86_64.
The problem is I cannot install both created apps on my android-device or emulator of android-studio.
I have 2 kind of errors:
first:
after importing the .apk in android-studio : .*so missing
second
after try to running app: INSTALL_FAILED_NO_MATCHING_ABIS
can somebody help me to solve this problem? I also read some issues on github of crosswalk, but they are not interested to replay their issues.
Thank you for your help!
The solution is to set android-minSdkVersion in config.xml to the latest version, like 28. Also just add this code in your config.xml and build the app via cordova build android again:
<preference name="android-minSdkVersion" value="28" />
After that there is a new apk-output, which names debug.apk. This apk is universal and can run on any devices.

Android Studio does not install app after using the Internal Test Track version

I've been working on my app for a while now and recently uploaded it to the Google Play Console's Internal Test Track. I installed my app via Google Play Store and it worked fine.
But if I now try to install an updated debug version via Android Studio directly it just launches my main activity without installing the changed app.
What I've tried:
Uninstalling app and running in via AS: "Error: Activity class {...} does not exist."
Restarting phone
Restarting AS
Reconnecting phone
Uninstalling app via AS (gradlew uA)
Uninstalling app via app manager
Invalidating AS cache
Cleaning / rebuilding project
Disabling Skip installation if APK has not changed in Run Configurations -> Miscellaneous
Increasing version number
What may cause it:
The Internal Test Track version is signed, but the key is kept by Google
The app is not selected as 'App to debug', but the dialog to choose one, does not offer it
How can I install my unreleased version via Android Studio directly again?
Thanks in advance. -Minding
QUICKFIX
The "Gradle Aware" task was missing for some reason. To fix it "Run" > "Edit configurations" > "+" > "Gradle-aware Make" > "OK" (leave the field empty) and restart.
The Android Studio team is still investigating why this happened.
Old answer / Workaround
Using the ADB to directly uninstall the release version and installing the debug version worked, but you have reinstall the app for every change! A better solution would still appreciated.
Build your project's debug APK
Enter the following into the terminal:
adb uninstall MY_PACKAGE_NAME
adb install -r ./mobile/build/outputs/apk/debug/mobile-debug.apk
If you get "adb" not found. use %LOCALAPPDATA%\Android\sdk\platform-tools\adb instead.
Select the app to be App to debug in the device's developer options.
Hope this help. -Minding

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.

cordova hybrid app build fail with vs2013 up2 (chinese traditional)

I build cordova project with vs2013 up2 for windows phone platform and receive some error as follow , but build for ios & android is ok .
(1)Non-whitespace before first tag.
I found the js file "C:\Users\xxx\AppData\Roaming\npm\node_modules\vs-mda\node_modules\cordova\node_modules\plugman\src\util\xml-helpers.js" in line 124 command
var contents = fs.readFileSync(filename, 'utf-8').replace("\ufeff", "");
...is failing in chinese traditional environment, when building for windows phone platform the WMAppManifest.xml file has BOM code , so will be error as 嚙踝蕭??xml version="1.0" encoding="utf-8"?>, it should be <?xml version="1.0" encoding="utf-8"?>
have any idea can fix it ?
Thanks.
The issue you are seeing (issues.apache.org/jira/browse/CB-5477) was fixed in Cordova 3.5
(I'm a new poster and haven't earned the reputation points to include more than 2 links in my response, so I'm saving those for the ones that matter below).
If you update to the latest CTP 2.0 for Multi-Device Hybrid Apps, you will pick up the fix.
Unfortunately, there is an other Cordova issue that still exists in version 3.5 which also impacts WP8 in localized environments (https://issues.apache.org/jira/browse/CB-6932).
It has been fixed in Cordova version 3.6 which hasn't yet been released, but here's how you can pick up the fix.
After installing the new MDD tools, create an MDD project and build for WP8. (It will fail under Chinese as it did before.)
Now go into c:\Users\<username>\cordova\lib\wp\cordova\3.5.0\wp8\bin
Replace the existing create.js with the version from here
(click "Raw" to view just the file contents)
https://github.com/MSOpenTech/cordova-wp8/blob/ac097f2801d4defe5e4d445e10b7102001631a54/wp8/bin/create.js
Create a new project and build again for wp8. It should work now and future projects should work as well.
For me, it worked by removing android and adding again.
remove:
ionic platform rm android
add:
ionic platform add android
You can execute these commands at your project directory.

Phonegap 3.4.0 fails to build new projects and update old projects

I recently updated phonegap, node, and npm. I have an existing project I previously built with Phonegap version 3.3.0. I then attempted to update my existing project using phonegap platform update ios and received an error stating that the '/platforms' directory does not exist.
I don't think it makes any difference, but I also tried to use the cordova command instead of the phonegap command, but I just get the same error as above. I even created a completely new project with phonegap create Test and I am able to get a project built successfully, but when I try to run/build I get a similar error: Error: /platforms does not exist. Please specify an existing parent folder. [error] /Users/mftcmbp1/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 1 Even stranger, I am able to successfully create a project with the cordova command, build ios and android platforms, and emulate the project, yet I can't do this with the phonegap command like I could before I updated.Any help or suggestions of why this would be occurring will be helpful.
Thanks!
Not sure if there is a bug with Phonegap 3.4.0, but I fixed my issue by uninstalling the latest Phonegap version and installing Phonegap version 3.3.0-0.19.4.
1- you need to 'cd' to your project and add platform first before build
cd Test
2- then add platform
iOS
phonegap platform add ios
android
phonegap platform add android
3- then you can build your project
iOS
phonegap build ios
android
phonegap build android
I ran into this over the weekend, have you tried:
$ mkdir project_directory/platforms
As I remember it, that solved the issue as a hotfix.
The error occured after a project was cloned from github without the platforms directory.
I ran into the same issue, and it looks like an error in the update script, and specifically this file:
node_modules/phonegap/node_modules/cordova/src/util.js
The quick fix is, in the function isRootDir, to change "config.xml" to ".cordova", i.e.:
- if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ if (fs.existsSync(path.join(dir, '.cordova'))) {
The old version identified the base project directory via the existence of the .cordova directory. The new version is incorrectly looking for a directory that contains these three items:
www/
config.xml
platforms/
config.xml should not be in the base directory, it's under www/, which is why it fails.
The script does have fail-safe, which is to look for www/config.xml. However, the way it does this is to continue traversing the tree towards root, and if at any time it finds another www/config.xml, will assume this is a better candidate for the project directory.
In your situation, I'm guessing you have a /www/config.xml off of your root directory, and PhoneGap is erroneously thinking that is your project directory.

Resources