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

Could not find method implementation() for arguments [project ':unityLibrary'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. #852

Open
007-liang opened this issue Jul 28, 2023 · 2 comments
Labels
android This issue is specific to the Android Platform. Build This issue refers to the build configuration and builds failing.

Comments

@007-liang
Copy link

Build file '/android/app/build.gradle' line: 42

  • What went wrong:
    A problem occurred evaluating project ':app'.

Could not find method implementation() for arguments [project ':unityLibrary'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

def localProperties = new Properties()
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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

buildscript {
    repositories {
        google()
        jcenter()
            
        maven {
           url "https://mvn.mob.com/android"
        }
         maven {
           url 'https://developer.huawei.com/repo/'
        }
    }
    
    dependencies {
        implementation project(':unityLibrary')

        classpath "com.mob.sdk:MobSDK2:+"
    }
}

android {
    namespace "xxx"
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "front.crypcore"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        // minSdkVersion flutter.minSdkVersion
        minSdkVersion 22
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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 project(':unityLibrary')

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
@007-liang
Copy link
Author

platform:

  • Mac OS 13.4
  • Flutter 3.13.0-6.0.pre.2
  • flutter_unity_widget 2022.2.0

@timbotimbo timbotimbo added android This issue is specific to the Android Platform. Build This issue refers to the build configuration and builds failing. labels Aug 21, 2023
@timbotimbo
Copy link
Collaborator

Looks like a bad gradle configuration.

You are importing unityLibrary in both line 42 and 92.
The one in 92 is how the example project and the readme do it, try removing the one at 42.
Nowehere in the docs or the example is unityLibrary imported inside a buildscript, try removing that.

I'm also not sure why you have a buildscript { .. } section here, new flutter projects usually have that in android/build.gradle instead of android/app/build.gradle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android This issue is specific to the Android Platform. Build This issue refers to the build configuration and builds failing.
Projects
None yet
Development

No branches or pull requests

2 participants