Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
850 stars 553 forks source link

[BUG]: Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':flutter_sound'. #1004

Closed GokulakrishnanV closed 3 months ago

GokulakrishnanV commented 5 months ago

Flutter Sound Version : ^9.2.13


Severity


Platforms you faced the error


Describe the bug A clear and concise description of what the bug is. I have upgraded my project to the latest version of the gradle plugin (v8.2.1) and the latest kotlin version (1.9.0). After upgrading, i can't build my app. Gradle sync fails with the message "Namespace not specified"

This is the stack trace 1: Task failed with an exception.

2: Task failed with an exception.

BUILD FAILED in 1s Exception: Gradle task assembleDebug failed with exit code 1

To Reproduce Steps to reproduce the behavior:

  1. Update the gradle plugin version to 8.2.1 and kotlin version to 1.9.0 and build the flutter project.

Project level Gradle

          buildscript {
              ext.kotlin_version = '1.9.0'
              repositories {
                  google()
                  mavenCentral()
              }

              dependencies {
                  classpath 'com.android.tools.build:gradle:8.2.1'
                  // START: FlutterFire Configuration
                  classpath 'com.google.gms:google-services:4.4.0'
                  // END: FlutterFire Configuration
                  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
              }
          }

          allprojects {
              repositories {
                  google()
                  mavenCentral()
              }
          }

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

  tasks.register("clean", Delete) {
      delete rootProject.buildDir
  }

App level Gradle

          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'
        }

        def keystoreProperties = new Properties()
        def keystorePropertiesFile = rootProject.file('key.properties')
        if (keystorePropertiesFile.exists()) {
            keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
        }

        apply plugin: 'com.android.application'
        // START: FlutterFire Configuration
        apply plugin: 'com.google.gms.google-services'
        // END: FlutterFire Configuration
        apply plugin: 'kotlin-android'
        apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

        android {
            namespace "com.abc.de"
            compileSdk 34
            ndkVersion flutter.ndkVersion

            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 "com.abc.de"
                // 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 23
                targetSdkVersion 34
                versionCode flutterVersionCode.toInteger()
                versionName flutterVersionName
            }

            signingConfigs{
                release {
                    keyAlias keystoreProperties['keyAlias']
                    keyPassword keystoreProperties['keyPassword']
                    storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                    storePassword keystoreProperties['storePassword']
                }
            }

            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.release
                }
            }
        }

        flutter {
            source '../..'
        }

        dependencies {
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
            implementation 'com.stripe:stripe-android:20.34.4'
            implementation 'com.google.android.material:material:1.11.0'
        }
GokulakrishnanV commented 5 months ago

I resolved it by adding namespace attribute to the build.gradle file of the flutter_sound package

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 365 days with no activity. Leave a comment or this will be closed in 7 days.

Larpoux commented 3 months ago

OK Fixed in Flutter Sound 9.4.5