diff --git a/bin/templates/cordova/lib/builders/StudioBuilder.js b/bin/templates/cordova/lib/builders/StudioBuilder.js index 99b20687..f65ff264 100644 --- a/bin/templates/cordova/lib/builders/StudioBuilder.js +++ b/bin/templates/cordova/lib/builders/StudioBuilder.js @@ -154,7 +154,7 @@ StudioBuilder.prototype.prepBuildFiles = function () { 'include ":"\n' + settingsGradlePaths.join('')); // Update dependencies within build.gradle. - var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8'); + var buildGradle = fs.readFileSync(path.join(this.root, 'app', 'build.gradle'), 'utf8'); var depsList = ''; var root = this.root; var insertExclude = function (p) { @@ -170,8 +170,10 @@ StudioBuilder.prototype.prepBuildFiles = function () { subProjects.forEach(function (p) { console.log('Subproject Path: ' + p); var libName = p.replace(/[/\\]/g, ':').replace(name + '-', ''); - depsList += ' implementation(project(path: "' + libName + '", configuration: "release"))'; - insertExclude(p); + if(libName !== 'app') { + depsList += ' implementation(project(path: ":' + libName + '"))'; + insertExclude(p); + } }); // For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390 var SYSTEM_LIBRARY_MAPPINGS = [ @@ -223,7 +225,7 @@ StudioBuilder.prototype.prepEnv = function (opts) { // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with. // For some reason, using ^ and $ don't work. This does the job, though. var distributionUrlRegex = /distributionUrl.*zip/; - var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip'; + var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip'; var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties'); shell.chmod('u+w', gradleWrapperPropertiesPath); shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath); diff --git a/bin/templates/project/app/build.gradle b/bin/templates/project/app/build.gradle index f2c4f294..08e130d3 100644 --- a/bin/templates/project/app/build.gradle +++ b/bin/templates/project/app/build.gradle @@ -23,10 +23,13 @@ buildscript { repositories { mavenCentral() jcenter() + maven { + url "https://maven.google.com" + } } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:3.0.0' } } @@ -39,7 +42,7 @@ allprojects { } task wrapper(type: Wrapper) { - gradleVersion = '3.3.0' + gradleVersion = '4.1.0' } // Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. @@ -227,7 +230,7 @@ android { dependencies { - compile fileTree(dir: 'libs', include: '*.jar') + implementation fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: ":CordovaLib", configuration: "debug")) releaseCompile(project(path: ":CordovaLib", configuration: "release"))