Skip to content

bug(android) plugin built with wrong sdk/tools versions #1123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NickIliev opened this issue Jul 26, 2018 · 1 comment
Closed

bug(android) plugin built with wrong sdk/tools versions #1123

NickIliev opened this issue Jul 26, 2018 · 1 comment

Comments

@NickIliev
Copy link

From @farfromrefug on July 25, 2018 15:27

I 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

Copied from original issue: NativeScript/nativescript-cli#3773

@NickIliev
Copy link
Author

Closing as the solution for the issue is indeed n the CLI (opened issue here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant