bug(android) plugin built with wrong sdk/tools versions
See original GitHub issueI have a plugin which needs the very last support library.
Consequently I set up include.gradle
with the correct version. You can see it here
However when I build through my app it fails because the plugin is built with the wrong versions. If I print the corresponding gradle call:
/gradlew -p /myappfolder/platforms/tempPlugin/nativescript_material_components assembleRelease -PcompileSdk=android-27 -PbuildToolsVersion=27.0.3 -PsupportVersion=26.0.0-alpha1
The build.gradle within the temp folder does not take into account the targetSDk or compileSDKVersion that I have set-up in include.gradle
. Only the dependencies are correct.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
apply plugin: 'com.android.library'
def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 24 }
def computeBuildToolsVersion = { ->
project.hasProperty("buildToolsVersion") ? buildToolsVersion : "27.0.3"
}
android {
compileSdkVersion computeCompileSdkVersion()
buildToolsVersion computeBuildToolsVersion()
defaultConfig {
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
}
dependencies {
def supportVer = "27.0.1"
if (project.hasProperty("supportVersion")) {
supportVer = supportVersion
}
compileOnly "com.android.support:support-v4:$supportVer"
compileOnly "com.android.support:appcompat-v7:$supportVer"
}
dependencies {
compile "com.android.support:appcompat-v7:28+"
compile 'com.android.support:design:28+'
}
That build.gradle
should have targetSDKVersion, compileSDKVersion, buildToolsVersion setup in that order:
- if the app app.gradle has a version use this one
- if not and if the plugin has a version, use the plugin version
- use the default version
BTW in the default app `build.gradle``` the applying
The order should be
setAppIdentifier()
applyPluginGradleConfigurations()
applyAppGradleConfiguration()
User app configuration should always overrule.
Right now I can’t seem to find a way to compile my app with that module. Any help would be appreciated
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
This is fixed in latest cli versions
Hey @farfromrefug , We are still testing the behavior and issues that might occur with the current case. But yes, you should be able to use it in a plugin. You can also set the following in your
app.gradle
(at the root fo the file):In case you want to set it from a plugin, I recommend you to put something like this in your
include.gradle
:Using the code above will allow the application author to control the version from a single place (project’s
app.gradle
for example).