mikeperri / flutter_sequencer

A Flutter plugin for music sequencing.
Other
90 stars 38 forks source link

Error when building in vscode #26

Closed thusimon closed 2 years ago

thusimon commented 2 years ago

Hi Team, I added latest version flutter_sequencer: ^0.4.3 in dependency and run the app in vscode, but I got these errors

Launching lib\main.dart on sdk gphone x86 in debug mode...

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\xxxx\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_sequencer-0.4.3\android\build.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':flutter_sequencer'.

> Failed to apply plugin 'com.android.internal.library'.
   > The option 'android.enablePrefab' is deprecated.
     It was removed in version 4.1 of the Android Gradle plugin.
     This property has been replaced by android.buildFeatures.prefab (DSL)
* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 5s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

The error occurs in this line apply plugin: 'com.android.library'. I am not sure how to configure the enablePrefab I am on the Android studio version 2020.3.1. Any ideas to solve this? Thanks a lot!

postacik commented 2 years ago

I just had the same issue and solved by doing the following:

In file android\build.gradle change gradle version to 7.0.2 and ext.kotlin_version to 1.5.21 as below:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

In file android\gradle\wrapper\gradle-wrapper.properties change distributionUrl as the following:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

I hope this helps...

LeventeAsztalos commented 2 years ago

@postacik

I tried, but I get this error anyway. It looks like it won't fetch the third party repos for me. If I fetch them manually it works though.

/Users/admin/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.4.3/android/third_party/oboe

    does not contain a CMakeLists.txt file.

  CMake Error at CMakeLists.txt:22 (ADD_SUBDIRECTORY):
    The source directory

/Users/admin/.pub-cache/hosted/pub.dartlang.org/flutter_sequencer-0.4.3/android/third_party/sfizz

    does not contain a CMakeLists.txt file.
thusimon commented 2 years ago

Thanks a lot guys, I didn't encounter @jugamir 's issue, I just tried @postacik 's update, it builds successfully now:)