Showing posts with label Visual Studio 2017. Show all posts
Showing posts with label Visual Studio 2017. Show all posts

Wednesday, January 23, 2019

Could not start Gradle Daemon android build error in Cordova


This was the most confusing error I got when I was building  and release the app for Android Store. 

My android build configurations are listed bellow.

1. Tool Set - Cordova 6.3.1 using visual studio 2017
2. Target API level - 28
3. cordova-android @7.0.0


So the error message clearly gives the idea that Gradle deamon  cannot start to complete the android build. 

** First make sure you have installed and updated all the components for android SDK.


1. Lets check if you have installed Gradle, and it up and running. Open command prompt and enter the command 'gradle'.  If you getting the un-recognised command error move to the step 2.


2. Delete all existing installations of gradle.

3. Download gradle latest version from  https://gradle.org/releases/  

4. Copy the content to a folder in your C:\ drive.


5. Add gradle location to system variable 'path'.



6. Restart the computer and enter the command 'gradle' in command prompt.








Thursday, July 12, 2018

Android app missing permissions after publishing - Cordova, Visual Studio 2017


Hi All

All you have to do is update your android manifest file with required permission before create the release APK.

** You have to do it before every release if you cleaned the project.

 android:name="android.permission.CAMERA" />
 android:name="android.permission.FLASHLIGHT" />
 android:name="android.permission.ACCESS_NETWORK_STATE" />
 android:name="android.permission.INTERNET" />
 android:name="android.permission.READ_PHONE_STATE" />

Thursday, June 21, 2018

Cordova Gradle wrapper missing in android SDK


When you develop apps with Cordova and Microsoft Visual Studio there are some important facts you should know. I learned these things over 2.5 years of period.

1. Visual Studio tools for apache cordova is Microsoft product  and it's not updated alongside with other tools using by app developers.




So lets focus on this graddle issue. The latest android version released in 2018 is android 8.0 and 8.1 Oreo . But unfortunately microsoft tools for apache cordova is still supporting Android 7.1 - Nougat.

So in case you have updated your android  SDK and tools you might need to rollback that update to use Microsoft tools to build and release your app to Google Play. 

But again try to  keep Visual Studio for development tasks and always try to native tool set for release purposes. 

    

Thursday, May 3, 2018

How to load image on webview from ms-appdata:///local


I recently updated my  Visual Studio 2015  apache cordova project to visual studio 2017. I had few problems with working with angular js otherwise everything worked in windows 10 environment.

But what I noticed was images from ms-appdata:///local folder couldn't load  to img tags. I tried many ways like row html, dynamic tag creation and add url as a base64 data url.

In base64 solution it worked. But I want to get the file itself  as my app was supporting iOS and Android as well.

So after trying hundred things solutions was simple.  You have to set img-src  option to All ( *  ) Content-Security-Policy meta tag of the html file.

Please check following screen shot. You need to add the part with the read border to load image resources from any location.








Reference URL  if you need to see more options.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/default-src


Tuesday, May 1, 2018

Invalid command line switch for tsc.exe. Visual Studio 2015 - 2017



After I installed visual studio 2017 while I had visual studio 2015 in good working condition my visual studio 2015 cordova Javascript project gave me this error.


Invalid command line switch for tsc.exe


Possible cause for this one is with visual studio 2017, you'll be getting new typescript libraries. So visual studio 2015 is confusing when selecting the highest typescript version automatically.

If your project is javascript based cordova project fix is easy.

1. Open project file in notepad or any editor you using.
2. Edit following section.


* You cant use this fix for typescript based cordova projects.
* If you still see some errors your visual studio 2015 may needs a repair.  Please follow the link bellow regarding repairing vs 2015.

https://guntucomputerhacks.blogspot.com.au/2018/04/current-package-installation-is.html





Tuesday, April 10, 2018

Using GeoTag when taking photos through apps you developing - Apache Cordova


If your app need to tag photos with the location you need enable this feature from Cordova's config xml. Some android devices are tagging the photos with the location even if you havent enable this feature from the app. But for iOS it is compulsory to add this line to cordova configuration file to tag photos with the location.





reference. Cordova Documentation
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/

Wednesday, April 4, 2018

Current package installation is corrupted. Will cleanup and do a fresh installation. ( Apache Cordova Tools for Visual Studio 2015 )


Cause - According to my research of the issue. Please correct me if I'm wrong.

I had well working apache cordova project with Visual Studio 2015 and it worked without any issue for years. Recently I installed Visual Studio 2017 and did some research of creating a cordova project in higher version. I did not have any issue until I installed Visual Studio 2017 Update pack released on 4th of April 2018. After installing the update pack I had following error message whenever I'm trying to build the project. Even if I create a brand new project I had the same issue.

Current package installation is corrupted. Will cleanup and do a fresh installation. 

So the visual studio tried to repair the tools for cordova. If its successfully did that you will not have any issue. But in my case I had so many updated tools  and Visual Studio 2015 kept giving errors while downloading new npm packages. Specially following package.

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac  

I have put the solution in different blog post as these are two separate problems.

Click on following link.

https://guntucomputerhacks.blogspot.com.au/2018/04/package-downloading-problems-apache.html


Wednesday, September 6, 2017

The imported project "C:\Program Files (x86)\Microsoft SDKs\TypeScript\build\Microsoft.TypeScript.targets" was not found


All I did  to create above mess is...

1. Installing visual studio 2017 while working on visual studio 2015.
2. And I stopped the visual studio 2017 installation as I thought I would  do it in another day.


So the setup application has removed my installed typescript  plugin.  All you have to do is
install type script for Visual Studio 2015. You can download the setup from bellow link.


https://www.microsoft.com/en-us/download/details.aspx?id=48593