You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/06/12 22:45:04 UTC

[GitHub] [cordova-android] alschytte opened a new issue #745: bug / trivial programming error -- crash in fresh build 'Cannot read property 'length' of undefined'

alschytte opened a new issue #745: bug / trivial programming error -- crash in fresh build 'Cannot read property 'length' of undefined'
URL: https://github.com/apache/cordova-android/issues/745
 
 
   # Bug Report
   
   ## Problem
   a javascript file in cordova has a trivial and very-very old problem - this problems har been around for long, and you cannot build on windows unless you modify the check_reqs.js file in the  'platforms/android/cordova/lib' directory
   
   ### What is expected to happen?
   The build call 'get_gradle_wrapper'  to find an path to gradle but it fails, because the javascript that locates gradle-dir has a flaw
   
   ### What does actually happen?
   crash in build 'Cannot read property 'length' of undefined'
   
   ## Information
    line 116 your version
   -----------------------
         if (dirs[0].split('-')[0] === 'gradle') {
             console.log( dirs[0])
               return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
           }
   
   line 116 my version
   -----------------------
          var gradledir;
           dirs.forEach((dir) => {
             if (dir.split('-')[0] === 'gradle')
                 gradledir = path.join(androidStudioPath, dir, 'bin', 'gradle');
           });
          if (!gradledir)  
             throw new CordovaError('Could not find a version of gradle in Android Studio');
          return gradledir;
   
   The problems is that 'dirs' is an array and the gradle directory is (no more ?) the only sub-directory in 'androidstudiopath'. It's a simple error.
   
   ### Command or Code
   Fresh install 
   
        cordova build android --debug (or release)
   
   ### Environment, Platform, Device
   Windows 10, android app
   
   ### Version information
   cordova -v = 9.0.0 (cordova-lib@9.0.1)
   "cordova-android": "^8.0.0", (exists in 6 and 7 versions also )
   
   android studio 3.4.1 (but exists in android 2.1, 3.0, and 3.2 also)
   gradle 5.1.1 (also in 4.6)
   
   ## Checklist
   
   - [ x] I searched for existing GitHub issues
   - [ x] I updated all Cordova tooling to most recent version
   - [x ] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org