Software Archive
Read-only legacy content
17061 Discussions

Cloud build system

Laurent_C_
Beginner
916 Views

Hello!

Well, first of all, thank you for all these years offering android/ios/win10 cloud building. It's sad to see it go and to find only payant solutions. But understandable.

Removing yes, but since a while now I'm trying to manually build my androidapp, based on Intel XDK Cordova build package. Took me a while to figure out the certificate algorythm but that's ok, could have used my brain earlier also.

But I cannot get to what your cloud system was doing:
- My app is like 5 times slower  to load when manually built (about 2 sec loading when built with intel xdk, 10+ sec when built manually)
- Plugins like Google Play don't connect

What I do is, in a powershell:
- cordova clean
- cordova build --release android
- jarsigner
- zipalign

Could you please provide us with what the cloud build system is using to build our apps atm?

0 Kudos
1 Solution
PaulF_IntelCorp
Employee
916 Views

I'm not clear on why you installed one copy via Google Play and one manually? Why don't you load both manually? Just change the App ID in one so you can load both together on the same device. Is it possible there is some network caching taking place that gives the second app an advantage because the first already cached some files?

To make things truly comparable I suggest you uninstall your copy of Cordova CLI and install version 6.2.0 and build with that on your system (I'm assuming you are building with CLI 6.2.0 in the XDK cloud). Do the following at your command prompt:

> cd <cli-project-root>    # that is, cd to the root of your Cordova CLI project
> cordova platform rm android
> npm -g uninstall cordova
> npm -g install version-manager-cordova-software
> cvm install 6.2.0
> cordova --version
6.2.0

The above will remove the <project-root>/platforms/android folder from your project; uninstall CLI 7.0 from your system; install the "cvm" tool so you can install multiple copies of CLI; use cvm to install CLI 6.2.0; report the newly installed version of CLI (which should show 6.2.0, as shown above).

Then, add back the android platform to your project and build:

> cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
	Path: platforms/android
	Package: xdk.intel.third.party.crosswalk
	Name: 3rd_Party_Plugin__Crosswalk_
	Activity: MainActivity
	Android target: android-23
Android project created with cordova-android@5.1.1
Installing "cordova-plugin-battery-status" for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-dialogs" for android
Installing "cordova-plugin-screen-orientation" for android
Installing "cordova-plugin-splashscreen" for android
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
          
Installing "phonegap-plugin-barcodescanner" for android
>

The above output is for a different project, so it shows a different set of plugins than what you will see when you perform this command. The key thing to note is that the cordova-android platform is 5.1.1, which matches that used by the XDK cloud-based build system, not the cordova-android 6.2.3 framework that you're currently building against.

Now build your app manually (preferably with a slightly different ID assigned to one of them, so you can install both the XDK built version and the CLI built version on the same device). Compare the results with those two different builds.

I recommend that if you continue to see differences in performance, after doing the above, that you make sure you have "debug builds" installed on your device and use the debugging technique described here > https://software.intel.com/en-us/xdk/docs/using-remote-chrome-devtools-to-debug-android-cordova-apps < to monitor the JavaScript console when you run each app, there may be some useful messages there.

Also, did you confirm that you are getting a Crosswalk build from the manual build? CLI will generate multiple APK files, you'll need to identify the right one for installation onto your device. See the bottom of this doc page for help with identifying the CW builds > https://software.intel.com/en-us/xdk/docs/build-xdk-app-with-phonegap-cordova-cli < search for "platforms/android/build/outputs/apk/" on the page to find that help.

View solution in original post

0 Kudos
14 Replies
PaulF_IntelCorp
Employee
916 Views

Laurent -- the steps you outline are essentially the process we use in our build system. The only things I can think of that might be causing a difference in startup time of your app are:

  • a different version of the android-cordova framework (caused by different version of CLI and/or cordova-android framework)
  • different versions of the plugins being used (the export project does specify specific versions of the plugins)
  • different version of Crosswalk, or excluding/adding Crosswalk (for example you were not using CW, now you are?)
  • something in your app that is waiting on a specific event before the app can begin working (I have no way to know what "2 seconds loading" actually means, does it mean two seconds of the splash screen? or something else?)

When you install Cordova CLI, if you are not specific, you'll likely get the most recent version (currently CLI 7.0.1 > https://github.com/apache/cordova-cli/releases ). Some of the changes in Cordova CLI 7.x were significant, see this blog for some details > https://cordova.apache.org/news/2017/05/04/cordova-7.html < so we recommend using Cordova CLI 6.2 or 6.5 during the transition from the XDK to your own build system. If you want to insure you are installing and using the same version of CLI that we are using, you might try using the Cordova Version Manager tool that is referenced in > https://software.intel.com/en-us/xdk/docs/build-xdk-app-with-phonegap-cordova-cli < because it makes it much easier to install a version other than the "latest and greatest" version of CLI.

If you were using Crosswalk, are you still building with Crosswalk? If you were NOT using Crosswalk, are your builds now including Crosswalk?

If you are measuring the loading time via the splash screen, check the config.xml options for the splash screen, or your code that hides the splash screen image following detection of the Cordova ready event. Perhaps that plugin behavior has changed? Are you using the same version of the plugin in your CLI build as the XDK was specifying in our build?

0 Kudos
Laurent_C_
Beginner
916 Views

Thank you for your reply!

 

Well, I must say that this is all a bit new to me, I just only used Intel XDK to build a Cordova export from Construct 2 software (html5). Construct 2 exports to cordova, I open the project in Intel XDk, import the plugins needed and was just hitting build. Since I saw the deprecation notice, I started to dig into building myself.

So I still do the same, export as Cordova, open in Intel XDK to generate the Cordova Build Package, and then use Powershell to build using the steps described above. So I do not modify anything in Intel XDK, but just increase the version number and set an ID in my config.xml for Google Play services (which do not work when I build myself but work when building with the cloud)

When I say it takes longer, Construct 2 has a loader that loads the game and displays either a bar, a percentage, nothing, a logo etc. This comes after the splashscreen and before the first app layout. It preloads objects and sounds for further use. I use a percentage displaying. So if I was to export from Construct 2 just now and with the same export do a cloud build and a manual build (export cordova build package and powershell) this loading process would take about 5 times longer (0% - 100%) and my google play services wouldn't work (err_signin_required) where your cloud services would load very fast and (0% - 100%) services would connect. I thought about a compression or something

0 Kudos
PaulF_IntelCorp
Employee
916 Views

I think the key here is the part about the google play services not working (the "err_signing_required"). The time it takes to load resources within the app (that is, resources that are part of your application and located somewere in the www folder) is not going to vary by that factor. However, the time it takes to connect to something over the network can be highly variable. In this case, you're getting a network timeout that is likely causing the app to pause, until the timeout happens.

As an experiment, export a version of your app that does not include the google play services. This may cause some part of the app to fail, but hopefully not until after the game is ready to run. Then build that app both ways and compare the startup time. If they are the same (or nearly the same) I would say it is a strong indication that the access to the Google Play services is the problem.

Normally, I would expect the Google Play Services network problem to be related to the whitelist or the CSP rules in your HTML file. This is something that could be affected by the version of CLI that you are building against.

What do you get when you type "cordova --version" at the Powershell prompt?

For example:

$ cordova --version
6.2.0

What is reported when you type "cordova platform" at the Powershell prompt? You need to be inside your Cordova CLI project and have performed the "cordova platform add android" command.

For example:

$ cordova platform
Installed platforms:
  android 5.1.1
Available platforms: 
  amazon-fireos ~3.6.3 (deprecated)
  blackberry10 ~3.8.0
  browser ~4.1.0
  firefoxos ~3.6.3
  ios ~4.1.0
  osx ~4.0.1
  webos ~3.7.0

Please report these numbers and also try the experiment that removes Google Play Services.

0 Kudos
Laurent_C_
Beginner
916 Views

My cordova version is 7.0.1

Platforms (because I just need android for now, enough trouble with is, IOS/UWP can wait):


PS D:\build\ch> cordova platform
Installed platforms:
  android 6.2.3
Available platforms:
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  webos ~3.7.0
  windows ~5.0.0

My builds are using crosswalk, as stated by the apk name, built by Intel XDK Cloud:

crosswalk

As per you suspecting the online service being the problem for the load time, even though I can say it's not, I played it fair and and built with Intel XDK cloud and sent to Google Play, totally unimplemented the online services, built it manually and sent to my phone: Result (excpet for the app behaviors being broken ;) ) The load time is exactly the same as before: Cloud build beats my manual build by 10sec... (Cloud build loads in about 2 seconds, manual takes around 12 seconds). It's normal, Google Play services connection happens only once the loader has finished loading, so after that percentage showing screen.

0 Kudos
PaulF_IntelCorp
Employee
917 Views

I'm not clear on why you installed one copy via Google Play and one manually? Why don't you load both manually? Just change the App ID in one so you can load both together on the same device. Is it possible there is some network caching taking place that gives the second app an advantage because the first already cached some files?

To make things truly comparable I suggest you uninstall your copy of Cordova CLI and install version 6.2.0 and build with that on your system (I'm assuming you are building with CLI 6.2.0 in the XDK cloud). Do the following at your command prompt:

> cd <cli-project-root>    # that is, cd to the root of your Cordova CLI project
> cordova platform rm android
> npm -g uninstall cordova
> npm -g install version-manager-cordova-software
> cvm install 6.2.0
> cordova --version
6.2.0

The above will remove the <project-root>/platforms/android folder from your project; uninstall CLI 7.0 from your system; install the "cvm" tool so you can install multiple copies of CLI; use cvm to install CLI 6.2.0; report the newly installed version of CLI (which should show 6.2.0, as shown above).

Then, add back the android platform to your project and build:

> cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
	Path: platforms/android
	Package: xdk.intel.third.party.crosswalk
	Name: 3rd_Party_Plugin__Crosswalk_
	Activity: MainActivity
	Android target: android-23
Android project created with cordova-android@5.1.1
Installing "cordova-plugin-battery-status" for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-dialogs" for android
Installing "cordova-plugin-screen-orientation" for android
Installing "cordova-plugin-splashscreen" for android
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
          
Installing "phonegap-plugin-barcodescanner" for android
>

The above output is for a different project, so it shows a different set of plugins than what you will see when you perform this command. The key thing to note is that the cordova-android platform is 5.1.1, which matches that used by the XDK cloud-based build system, not the cordova-android 6.2.3 framework that you're currently building against.

Now build your app manually (preferably with a slightly different ID assigned to one of them, so you can install both the XDK built version and the CLI built version on the same device). Compare the results with those two different builds.

I recommend that if you continue to see differences in performance, after doing the above, that you make sure you have "debug builds" installed on your device and use the debugging technique described here > https://software.intel.com/en-us/xdk/docs/using-remote-chrome-devtools-to-debug-android-cordova-apps < to monitor the JavaScript console when you run each app, there may be some useful messages there.

Also, did you confirm that you are getting a Crosswalk build from the manual build? CLI will generate multiple APK files, you'll need to identify the right one for installation onto your device. See the bottom of this doc page for help with identifying the CW builds > https://software.intel.com/en-us/xdk/docs/build-xdk-app-with-phonegap-cordova-cli < search for "platforms/android/build/outputs/apk/" on the page to find that help.

0 Kudos
Laurent_C_
Beginner
916 Views

Thank you for al lyour help, but it's a lost case I think...

Yes, my intel cloud settings are using cordova 6.2.0

If i follow exactly what you say, I cannot use "cordova" commands anymore, as it is not recognized. I managed to install Cordova 6.2.0 as you wanted though, by using npm install install -g cordova@6.2.0. Past that, after adding android platform to my CLI project which says android version 5.1.1 as your exemple (yes, I have other plugins) I try to build using cordova build --release android but all I get is a

Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.

Through Android SDK manager I made sure that the sdk for the API level 22 is installed. I did reboot, Android is in my system PATh, nothing does it.

And to answer your first question, I did upload to Google Play because the one I had uploaded before was a manual build that takes ages to load and has broken Google Play services as they don't work when built manually. Cache vs no cache would mean a difference in first app start, where caching occurs. But it's always the same. Can't try, as I can't build since I went down to Cordova 6.2.0

EDIT
Yes, after spending actually 3 hours on it: I have downloaded the build tools for 21 22 and 25, I stil lget the path error. I cannot build at all anymore. Yes I do use the correct APK for my phone, the arm version for my SGS8+.

Checked "cordova requirements":
 

PS D:\build\ch> cordova requirements

Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: not installed
Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: C:\Users\Psychokiller1888\AppData\Local\Android\sdk\tools\templates\gradle\wrapper
Error: Some of requirements check failed
PS D:\build\ch> cordova build --release android

Android target says it's not installed, but I installed the apk for min version 16 and target Android API 21 through Android SDK manager

0 Kudos
PaulF_IntelCorp
Employee
916 Views

Did you set your ANDROID_HOME folder? Having Android in your path is not sufficient, you also need to define that ANDROID_HOME folder so it points to the Android SDK. For example, on my system:

$ env | grep HOME 
ANDROID_HOME=/Users/<userid>/Library/Android/sdk
$ which android
/Users/<userid>/Library/Android/sdk/tools/android

Above example is from a Mac. Unfortunately, my Windows machine was recently replaced and I haven't had time to set it up with Cordova and Android, so I cannot show you what it looks like there, but these commands should show you something (including if that env variable is set):

> set | find "HOME"
HOMEDRIVE=C:
HOMEPATH=\Users\<userid>

>where find
C:\Windows\System32\find.exe

>where android
INFO: Could not find files for the given pattern(s).

In the "set" example you can see that there is no ANDROID_HOME variable set. This is likely what you are going to see, meaning it is also NOT SET on your machine.

The second test shows that I have "find.exe" in my path, but I do not have "android" in my path (because I have not yet had time to re-install on my Windows box). So if the second succeeds (searching for Android), you're half there, but you do need to define the ANDROID_HOME variable.

Here's some help for defining ANDROID_HOME > https://developer.android.com/studio/command-line/variables.html

p.s. Have you tried building with PhoneGap Build? It's much easier and is free.

0 Kudos
Laurent_C_
Beginner
916 Views

Yeah, of  course my ANDROID_HOME is set, on windows it's under %localappdata%\Android\sdk

Spent so much time on this, Google is full of this problem, seems like Android changed the sdk structure or something like that.

I tried Phonegap, yesterday evening, after losing my nerves on build with cordova 6.2.0 :) What is free in that? Adobe is a greedy monster and has delirious prices for all their softwares

Will ultimately build the last day of june just before Intel SDK goes down and then dunno, will fiind a way to. I'll be back if I get anywhere with Cordova 6.2.0. Many thanks for you help up to here

0 Kudos
PaulF_IntelCorp
Employee
916 Views

You can build as many apps as you want in that "free slot." It's only an issue if you have a very large app or use private plugins, for most developers neither is a constraint.

I recommend trying to build with it to see if you get similar startup results in your app to the XDK build or to the CLI build. It would help to understand what is going wrong.

0 Kudos
Laurent_C_
Beginner
916 Views

Built with Phonegap I get the same results as using Intel XDK cloud build. 1-2 sec load time. The Google Play services seem not to work, but I should be digging further into that before asking. Phonegap is whining to update to Cordova 6.5.0 though and creates on apk with both the arm and x86 version. Will have to make tests I guess.

0 Kudos
Laurent_C_
Beginner
916 Views

Some news:

- I totally removed Android Studio
- I totally removed anything and everything that has to do with cordova, npm, cvm
- I cleaned my PATH env vars
- I reinstalled node.js
- I added cordova 6.2.0 using "npm -g install cordova@6.2.0" as it wouldn't work througn npm
- Installed Android Studio
- I installed all sdk/tools I saw any reference on either Construct 2, Intel XDK, the cordova export and my cmd, from Android SDK manager

"cordova platform add android" worked
"cordova build --release android" didn't work. Whining for a missing ANDROID_HOME path env var. Made sure it was there. Restarted computer, same story

Went back to google and searched further for this error and came on Stackoverflow:

https://stackoverflow.com/questions/42950169/android-sdk-not-found-make-sure-that-it-is-installed-if-it-is-not-at-the-defau

I followed the most upvoted solution and downloaded the tools (replaced 'linux' in the link with 'windows'

Restarted my computer, ran "cordova build --release android" and this time it worked!

Then, well, after signing and zipaligning, I crossed my fingers, squeezed everything I could and installed the app on my phone...

Light fast loading as Intel XDK was doing and working Google Play services! OMG, does this mean I finally made it? Well, I wouldn't have been able to without your help, the key was using cordova 6.2.0!

I don't know how to thank you enough for your patience and your help

0 Kudos
PaulF_IntelCorp
Employee
916 Views

Glad you got it to work! There have been some significant changes with CLI 7.x, so I think it's best to stick with CLI 6.x until you're really confident about the process, etc. I think it should be safe to move to 6.5 from 6.2, but don't be in a hurry to move to CLI 7.x.

The value of using cvm to install your cordova versions locally is that you can switch between the different versions of Cordova to quickly compare build results (you also have to do a "cordova platform remove android" followed by a "cordova platform add android" to really compare). Of course, you could also just setup a second machine with another version of CLI (I would recommend setting up a test machine running CLI 6.5) and do the builds there, for comparison with 6.2 builds.

In any event, I think the key is that you're using the cordova-android platform version that is pinned to CLI 6.2. You can update that platform without updating CLI, but be careful, because that's where the code that goes on the device comes from, it doesn't come from CLI, that is mostly the stuff that makes the build process work, rather, the code that effects the behavior on your device comes from your source code, the specific plugin versions you're using and the cordova-android framework (that which is reported by the "cordova platform" command).

0 Kudos
PaulF_IntelCorp
Employee
916 Views

Laurent C. wrote:

Phonegap ... creates on apk with both the arm and x86 version.

If you have enabled Crosswalk then the formula that is inside the exported config.xml is instructing PhoneGap Build to create an APK with both libraries embedded (that is, a multi-architecture APK). This is the only way to get a Crosswalk build to work with PhoneGap Build, because they only return a single APK file following the build.

If you are only targeting Android 5 and above you do not need to use Crosswalk.

You may be able to eliminate the use of Crosswalk if you are targeting Android 4.4 and later, because Android 4.4 also uses a Chromium-based runtime, but the one in Android 4.4 is not updated via the store like the one in Android 5 and later.

If you are targeting Android 4.1-4.3 you should use Crosswalk.

0 Kudos
PaulF_IntelCorp
Employee
916 Views

Laurent C. wrote:

"cordova build --release android" didn't work. Whining for a missing ANDROID_HOME path env var. Made sure it was there. Restarted computer, same story. Went back to google and searched further for this error and came on Stackoverflow:

https://stackoverflow.com/questions/42950169/android-sdk-not-found-make-...

I followed the most upvoted solution and downloaded the tools (replaced 'linux' in the link with 'windows'

For anyone else who is reading this thread, the StackOverflow post of interest is this one > https://stackoverflow.com/a/42983536/2914328 < and the android SDK downloads per that thread would be:

At the time of this post, the most recent version of the Android SDK corresponds to the following downloads:

You can determine the most recent version of the SDK by starting the Android SDK Manager (assuming you have installed Android Studio) and checking the version numbers at the top of the "Tools" section, for example:

Screen Shot 2017-06-28 at 09.15.35 .png

In addition, the StackOverflow post mentions installing in your /Android/sdk/tools folder. That is not precisely correct. You will find an "Android/sdk/tools" folder somewhere on your system; the precise location is a function of your OS and how and where you installed the Android SDK tools, so you'll have to look for that folder. If you open the Android SDK Manager app you should see the path to the SDK folders (at the very top of the image above, part of the path has been removed to hide my Intel userid -- so, for example, on my machine it is located at /Users/<userid>/Library/Android/sdk).

 

0 Kudos
Reply