How To Prevent Cordova Build Command From Auto-generating Settings.gradle
I have created a Cordova App with a custom settings.gradle as folows: // GENERATED FILE - DO NOT EDIT include ':' include ':CordovaLib' include 'manager' project(':manager').projec
Solution 1:
Today i faced the same problem and by spending hours i found that we can do this by change in project.properties
Below are the steps:
Step-1. Edit/Make project.properties
in root directory and add your module as library reference after CordovaLib
:
target=android-25android.library.reference.1=CordovaLib
android.library.reference.2=libraryModule1
android.library.reference.3=libraryModule2
Step-2. Run cordova build android
. This will make an entry in your setting.gradle
file.
//GENERATED FILE - DO NOT EDITinclude":"include":CordovaLib"include":libraryModule1"include":libraryModule2"
Also your app build.gradle
will look like this:
dependencies {
----// SUB-PROJECT DEPENDENCIES STARTdebugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
debugCompile(project(path: "libraryModule1", configuration: "debug"))
releaseCompile(project(path: "libraryModule1", configuration: "release"))
debugCompile(project(path: "libraryModule2", configuration: "debug"))
releaseCompile(project(path: "libraryModule2", configuration: "release"))
----// SUB-PROJECT DEPENDENCIES END
}
For project(':manager').projectDir = new File('libs/ConnectManager')
this kind of setting there is no easy way i found but you can achieve in this way:
Step-1. /path/to/project/platforms/android/cordova/lib/builders/GradleBuilder.js
Step-2. Edit fs.writeFileSync() function(Line-100)
// Write the settings.gradle file.fs.writeFileSync(path.join(this.root, 'settings.gradle'),
'// GENERATED FILE - DO NOT EDIT\n' +
'include ":"\n' + settingsGradlePaths.join('')+ "'include :"+libraryModule1+" \n'+ 'include :"+libraryModule2+"');
// Update dependencies within build.gradle.
Post a Comment for "How To Prevent Cordova Build Command From Auto-generating Settings.gradle"