[ 
https://issues.apache.org/jira/browse/CB-12524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15903702#comment-15903702
 ] 

ASF GitHub Bot commented on CB-12524:
-------------------------------------

Github user filmaj commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/367#discussion_r105241092
  
    --- Diff: bin/lib/check_reqs.js ---
    @@ -78,21 +79,46 @@ module.exports.check_ant = function() {
         });
     };
     
    +module.exports.get_gradle_wrapper = function() {
    +    var androidStudioPath;
    +    if(os.platform() == "darwin") {
    +      androidStudioPath = path.join('/Applications', 'Android Studio.app', 
'Contents', 'gradle');
    +    } else if (os.platform() == "win32") {
    +      androidStudioPath = path.join(process.env["ProgramFiles"],'Android', 
'Android Studio', 'gradle');
    +    }
    +
    +    if(androidStudioPath != null && fs.existsSync(androidStudioPath)) {
    +      var dirs = fs.readdirSync(androidStudioPath);
    +      if(dirs[0].split('-')[0] == "gradle")
    +      {
    +        return path.join(androidStudioPath, dirs[0], "bin", "gradle");
    +      }
    +    } else {
    +      //OK, let's try to check for Gradle!
    +      return forgivingWhichSync('gradle');
    +    }
    +};
    +
     // Returns a promise. Called only by build and clean commands.
     module.exports.check_gradle = function() {
         var sdkDir = process.env['ANDROID_HOME'];
    +    var d = Q.defer();
         if (!sdkDir)
             return Q.reject(new CordovaError('Could not find gradle wrapper 
within Android SDK. Could not find Android SDK directory.\n' +
                 'Might need to install Android SDK or set up \'ANDROID_HOME\' 
env variable.'));
     
    -    var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 
'wrapper');
    -    if (!fs.existsSync(wrapperDir)) {
    -        return Q.reject(new CordovaError('Could not find gradle wrapper 
within Android SDK. Might need to update your Android SDK.\n' +
    -            'Looked here: ' + wrapperDir));
    -    }
    -    return Q.when();
    +    var path = this.get_gradle_wrapper();
    +    console.log(path);
    --- End diff --
    
    Probably want to remove this console.log?


> add plugin failing because it cannot find tools/templates
> ---------------------------------------------------------
>
>                 Key: CB-12524
>                 URL: https://issues.apache.org/jira/browse/CB-12524
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, App Hello World
>    Affects Versions: 6.5.0
>         Environment: Mac OSX 10.12.3
> Cordova 6.5.0
> Android 6.1.2
>            Reporter: Gary N Griswold
>            Assignee: Joe Bowser
>            Priority: Blocker
>
> plugin add is failing because it is looking for in 
> sdk/tools/templates/gradle/wrapper, but tools/templates does not exist.
> The reference to the missing templates directory is found in 
> {quote}check_reqs.js line 88{quote}
> {code}
> platforms/android/cordova/lib/check_reqs.js
> line 88: var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 
> 'wrapper');
> Please see the
> cordova plugin add $HOME/<local file spec>
> Failed to install 'com-shortsands-videoplayer':CordovaError: Could not find 
> gradle wrapper within Android SDK. Might need to update your Android SDK.
> Looked here: 
> /Users/garygriswold/Library/Android/sdk/tools/templates/gradle/wrapper
>     at Object.module.exports.check_gradle 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/lib/check_reqs.js:90:25)
>     at GradleBuilder.prepEnv 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/lib/builders/GradleBuilder.js:161:23)
>     at Api.module.exports.runClean 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/lib/build.js:131:20)
>     at 
> /Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/Api.js:394:50
>     at _fulfilled 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:834:54)
>     at self.promiseDispatch.done 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:863:30)
>     at Promise.promise.promiseDispatch 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:796:13)
>     at 
> /Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:604:44
>     at runSingle 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:137:13)
>     at flush 
> (/Users/garygriswold/ShortSands/VideoProto/platforms/android/cordova/node_modules/q/q.js:125:13)
> Error: Could not find gradle wrapper within Android SDK. Might need to update 
> your Android SDK.
> Looked here: 
> /Users/garygriswold/Library/Android/sdk/tools/templates/gradle/wrapper
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to