Challenges we are facing to build android day to day

We are a team of 4 to 5 developers working on building android apps mainly,

Our Environment
Development environment is windows 7,
node : 6.10 ( LTS), npm latest version.
cordova : 6.x, building for android api target 23 and above.
ionic CLI : 3.6.0, ionic framework : 3.6

Note : we are behind a corporate proxy

Daily workflow:
Our team is mainly working on some enterprise level apps, with similar set of features, releasing multiple versions of the same app modified to a different customers need…
we are using set of 10 to 15 cordova plugins ( for push, maps apis, splash, keyboard, camera, etc…)
some times all the 4 to 5 developers will working on each of the app we plan to release.

Some challenges we are facing

  • Building Andoroid Apk fails for many exceptions and reasons, ( success rate is 6/10).

  • Its been taking long time to give a proper apk files for test cycles because of build issues we keep facing.

  • Many of the issues are faced in ( cordova build android step )

  • we feel we are loosing productivity and getting difficult to cope up with the timelines

  • we often remove android platform and add ( when we are not able to fix the issue at gradle level because of unknown reasons )

  • its becoming tough to debug apk ( of so many plugins, build time issues, run time debugging of the app - as no live reload debugging not available as for my knowledge for android )

  • difficult to debug the apps, as our mobiles are also not connected to same network as that of development machines.

I need suggestions or help on

  • how your teams going through building app in ionic,
  • are we missing anything important here, which can improve the speed of delivery of the app for test
  • what should be an ideal environment to avoid version conflicts ( mainly cordova).
  • how do we avoid frequent build issues,
  • any thing else can be fixed, when multiple ppl involved.

Thanks for reading this lengthy post, suggestions are welcome
I would be ready to provide any specific details if you need further to understand our problem better.

1 Like

What exact errors are you getting in the build process? In general the Android build process should be pretty stable.

In a former job we fixed this by having our own Wifi that our development machines and mobile devices were connected to. You have to be on the same network for live reload.

Decide on one set of versions. For example Cordova CLI 7.0.1 with cordova-android 6.2.3. The CLI everyone will have to take care manually as it is a global install, the platform will be taken from config.xml and installed correctly.

1 Like

Thanks for looking into
the issues I faced today,
Issue : Unable to delete intermediates ( this one has repeated in past )
2017-08-29_17h19_09

Then I tried : gradle clean
2017-08-29_18h13_14

I got a next error:

What do you get with cordova requirements?

What exact command are you using to build?

You might want to use CLI Commands - Apache Cordova instead of going into the Android project itself and do gradle stuff.

Can you just remove your android platform and re-add it or is there any manual manipulation necessary of the generated Android project?

What do you get with cordova requirements?

What exact command are you using to build?

ionic cordova build android --prod

normally the default goto solution we are following now a days is to add platform a fresh,
( this is time consuming for us, as we need to change gradle wrapper version, some proxy issues … and then update gradleBuilder.js file with the correct matching gradle version to 2.14.1 instead of the default 3.3 )

How much time your applications take to appear first screen?

Why exactly do you need to do that? In general you don’t want to touch the generated projects at all - this might very well be the source for all your problems.

less than 5 seconds, and its working with ( --prod build only)

What you do to overlap this time?
I mean in release application, we can’t go ahead with that start time.

We are behind the corporate proxy, and I get into issues to download all the dependencies,

we are forced to modify, Here are some steps we are following to get through

I don’t have experience with this, but is there really no better way? Whitelist the domains, set some ENV variables, whatever. I would go to great lengths to avoid having to mess with the Android project in a way that makes the general, normal process so much more painful.

we do set http_proxy https_proxy and proxy at npm level,
I am not sure if there are any special proxy at cordova level,
gradle.properties also has been updated with proxy.

Cordova is not involved at that level. After you created the platform, the commands work on that code directly.

So to recapture:
You have unreliable Android builds because of unknown reasons - it just breaks with different error messages.
Removing and re-adding the platform is not a viable solutions as you need modifications on your Android project for it to work in your corporate environment, i.e. some stupid proxy.

Any other possible reasons that your Android builds could be so unreliable? Something messing with files on your work computers maybe? The problems you posted above don’t really look like they would be cause by updating the gradle verison etc…

As a general comment, the weirdest build errors I’ve seen on this forum seem to involve gradle. If there’s a way to remove it from your workflow, at least until the end stage of the project, it might be worthwhile. Let npm and app-scripts do all the work.

(I understood them that these gradle error are mostly thrown on ionic cordova build android - where there is no way around it as this actually does the Android build)

In that case, never mind! Maybe. I build for Android, and I’ve never run into them, no idea why I’ve been lucky.

Uh, better find some wood to know on fast…

Hi , i also work behind corporate proxies and have faced all these issues you have mentioned here. Sometimes i install dependencies with --unsafe-perm command on npm but it doesnt always work.

As far as I can see from your example that your root folder for project is kept inside deep folder, try to keep your project folder names small and the URL shortened so teh Gradle build doenot fail other wise you will have to manually delete the generated intermediates (yes you can manually delete only the generated intermediates folder inside platform folder).

As we have updated our versions to latest Ionic and cordova versions, the errors are minimized. Stillkeep your URLS shorter to for gradle to successfully build.

@shivamsngh Do you edit build.gradle files and gradleBuilder.js every time you add the platform ?
to fix versions
to resolve proxy issues?

I only add platform once without any issues, I, some times, have to clear the generated intermediate path in my project(you might find it here ~\platforms\android\build) . It would be better if you could put the problems you faced due to PROXY, probably a screenshot.

Regarding teh cordova build failed in :mergeDebugResources or :processDebugResources, I have faced it multiple times and the best solution is to shorten project URL and keep teh apps scripts updated.

Please put the ionic info(run "ionic info " in your bash/command) here for more insights.

1 Like