Skip to content
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

Gradel Sync and build fail #156

Open
rayh0001 opened this issue Jan 9, 2020 · 2 comments
Open

Gradel Sync and build fail #156

rayh0001 opened this issue Jan 9, 2020 · 2 comments

Comments

@rayh0001
Copy link

rayh0001 commented Jan 9, 2020

Following the instructions using Android Studio 3.5.3 and gradel 5.4.1. I get the error:

Could not find method compile() for arguments [com.github.ibm-cloud-security:appid-clientsdk-android:6.+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

@Ranibm
Copy link

Ranibm commented Jan 13, 2020

I tried building the App ID Android sample while using your versions of Android Studio (3.5.3) and Gradle (5.4.1), and it builds and runs as expected.
Could you try downloading the App ID Android sample from the App ID dashboard and checking if the build works for you?

Also, can you share your app module's build.gradle file (not the project's build.gradle)?

@rayh0001
Copy link
Author

rayh0001 commented Jan 15, 2020

Thanks @Ranibm. I was trying to add the sdk to an existing project, but the sample gave me a working model. plugin 3.3.2, with Gradel 4.10.2 seem to be ok now, anything higher causes some of the errors I shared before.
Project build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App build.gradle

def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.aa.appsink.flutter_app_1"
        minSdkVersion 27
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = ['appIdRedirectScheme': android.defaultConfig.applicationId]
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'com.github.ibm-cloud-security:appid-clientsdk-android:6.+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

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

2 participants