I am getting a failed build while running my project - flutter

I just upgraded my Android Studio and flutter SDK. When I try running my flutter project I keep getting this error below. I am using flutter_paystack: ^1.0.5+1 package.
Parameter format not correct -
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_paystack-1.0.5+1\android\src\main\kotlin\co\paystack\flutterpaystack\FlutterPaystackPlugin.kt: (48, 62): Type mismatch: inferred type is Activity? but Activity was expected
e: C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_paystack-1.0.5+1\android\src\main\kotlin\co\paystack\flutterpaystack\MethodCallHandlerImpl.kt: (19, 37): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_paystack:compileDebugKotlin'.
> Compilation error. See log for more details
* 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.
Please what might be the cause

package flutter_paystack: 1.0.5+1 not work on flutter 3
try change dependency of flutter_paystack 1.0.5+1 in pubspec.yaml to:
flutter_paystack:
git:
url: https://github.com/definitelyme/flutter_paystack.git
ref: a4a33c3dd0a12f46d655a2e63d11e9f20ba82d01

Go to your android/build.gradle file and update your Kotlin version hope its help to you.
ext.kotlin_version = '1.6.10'

This is mostly a problem with the Flutter version 3.
The best bet you have is to downgrade your flutter to version 2.x.x
This might conflict with other plugins you're using(like I experienced).
So you might as an alternative. Try embedding paystack payment in a webview. Create a web page, integrate paystack. Call that web page in a webview embedded in the app.
It might even be better if you're looking for extra payment options like bank transfer which isn't available on the flutter app plugin.

Related

Is there a new version for the flutter tflite package?

I started working with Flutter and Dart lately, and I'm building a project using the tflite package. But when I want to build the app, even the demo app when just adding the tflite package to my dependencies in pubspec.yaml, to my phone (Xiaomi redmi note 10, android 12) it shows this error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\tflite-1.1.2\android\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':tflite'.
> No signature of method: build_9lbq7rfhl5cpix99148s3txh6.android() is applicable for argument types: (build_9lbq7rfhl5cpix99148s3txh6$_run_closure2) values: [build_9lbq7rfhl5cpix99148s3txh6$_run_closure2#77b9e791]
* 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 5s
Exception: Gradle task assembleDebug failed with exit code 1
Also, when I firstly clicked 'pub get' after depending on tflite, it showed this error:
The plugin `tflite` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
but since I am not the package author, i didn't thought much of it.
I've seen that the tflite package was lastly updated 18 months ago.
So, is there an updated version of the package? Or, is there an alternative for running the google teachable machine?
That is the last known edit to the package. If there are issues that make it unusable now, I'd suggest leaving an issue on their GitHub page so that they can address it moving forward. Unfortunately, you might have to find an alternative to using that package, or edit the package locally yourself to get rid of any dependency issues.
Judging from the volume of issues on this package raised on github (https://github.com/shaqian/flutter_tflite), I don't think it's being maintained at all anymore.

pubpspect get failed when adding flutter_html lib in flutter

I have tried to build app 'flutter_html: ^2.1.5" but I unable to build and getting below error in log.
The current Flutter SDK version is 1.27.0-2.0.pre.1.
Because flutter_app depends on flutter_html >=2.1.0 which requires Flutter SDK version >=2.2.0, version solving failed.
pub get failed (1; Because flutter_app depends on flutter_html >=2.1.0 which requires Flutter SDK version >=2.2.0, version solving failed.)
can you suggest the way to clear this issue?
I have upgraded flutter version and migrated and having different issue.
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest').
- In plugin 'com.android.build.gradle.api.AndroidBasePlugin' type 'com.android.build.gradle.internal.tasks.CheckManifest' property 'manifest' has #Input annotation used on property of type 'File'.
Reason: A property of type 'File' annotated with #Input cannot determine how to interpret the file.
Possible solutions:
1. Annotate with #InputFile for regular files.
2. Annotate with #InputDirectory for directories.
3. If you want to track the path, return File.absolutePath as a String and keep #Input.
Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
* 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 11s
Exception: Gradle task assembleDebug failed with exit code 1
You need to upgrade your flutter SDK. Write flutter upgrade in terminal.
Or use an older version of flutter_html.

Flutter :: Camera plugin issue :: Application is not working in android but it is suitable for iOS

I am new to flutter development basically I am an ios developer,
While I am working on a new project in a flutter doing for the profile update screen
I have added a camera plugin for dependencies to get camera third-party to use both in ios android. So when it uses the ios application is running smoothly without showing an error but the android application showing some errors as follows
FAILURE: Build failed with an exception.
* What went wrong:
Task 'assembleAarRelease' not found in root project 'camera'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 1s
Exception: The plugin camera could not be built due to the issue above.
can anyone tell what is the solution for this issue?
compileSdkVersion in build.gradle it ma about compileSdkVersion. Should be updated 29 or higher or
If you set 'org.gradle.configureondemand=true' in 'gradle.properties',please change to false.
Have you tried changing compileSdkVersion in build.gradle to a higher version like from 28 to 29 or 30?
I do see similar Github issues where some had success by updating classpath to com.android.tools.build:gradle:4.0.1 eg: https://github.com/Baseflow/flutter-permission-handler/issues/208. Have you tried that?
I have tried this to solve my issue
in androidmanifest.xml my user-permission was in wrong place and marked as red
moved outside and worked.

Flutter Execution failed for task ':audioplayers:compileDebugKotlin'

I tried installing audioplayers: ^0.17.1 and ran my flutter project. It throws the following error. Can someone help, please?
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (181, 52): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\AudioplayersPlugin.kt: (231, 38): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\ByteDataSource.kt: (8, 37): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedMediaPlayer.kt: (10, 39): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (168, 32): Expecting a parameter declaration
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (205, 26): Expecting an argument
e: C:\Users\User\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\audioplayers\WrappedSoundPool.kt: (46, 77): Type inference failed. Expected type mismatch: inferred type is List<???> but MutableList<WrappedSoundPool> was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayers:compileDebugKotlin'.
> Compilation error. See log for more details
* 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 37s
Exception: Gradle task assembleDebug failed with exit code 1
I had been struggling with this issue since morning and finally here are 2 fixes:
Upgrade to flutter 2.0 and then update audioplayers dependency to 0.19.0 in pubspec.yaml
*in the build.gradle change ext.kotlin_version to '1.4.32'
or
If you don't want to upgrade to flutter 2.0 due to some reasons then downgrade your audioplayers dependency to ^0.16.0.
Note: To update Flutter SDK use the flutter upgrade command.
The current latest version is 0.18.0, but I faced the same problem. And I could solve that problem by following Gradle Build Failing.
In order to support the playBytes method, this has a hard requirement on using API >= 23 features, and your build may failure depending on your minimum SDK targeting. To override this, you will need to add
<uses-sdk tools:overrideLibrary="xyz.luan.audioplayers"/> to your AndroidManifest.xml file.
If you still facing an error on the compiling, you should change version of kotline following this issue.
faced same issue, fixed by updating ext.kotlin_version to 1.4.31 in android/build.gradle.
Downgrade your audioplayers dependency to ^0.16.0
Open C:\Users\User\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\src\main\kotlin\xyz\luan\ folder and delete it.
It helps me

Flutter: build error when adding "image_cropper" and "contacts_service" packages

I can successfully build and run a fresh new flutter project. But when I add both image_cropper: ^1.0.0 and contacts_service: ^0.2.4 packages to pubspec.yaml and run flutter packages get, I cannot build the project anymore, and get this build error:
D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\2.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\3.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\4.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\5.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\6.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\7.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\8.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\9.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\10.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\11.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\12.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\13.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\14.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\15.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\16.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\17.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\18.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\19.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\20.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\21.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\22.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\23.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\24.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\25.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\26.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\27.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\28.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\29.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\30.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\31.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\32.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\33.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\34.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\35.jar, E:\Projects\flutter\hello\build\app\intermediates\transforms\dexBuilder\debug\36.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
* 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 19s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https:///CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
I do not understand this error very well, but it seems that there is a naming conflict between these two packages (because of duplicate_classes in the error text). Is there any workaround for this?
Note that this error does not happen with any other pair of packages for me.
In build.gradle defaultConfig add multiDexEnabled true
This was an Android X compatibility issue. I could get it fixed by following the steps mentioned here, but in summary:
First make sure that compileSdkVersion is at least 28 in app/build.gradle. This property controls the version of the Android SDK that Gradle uses to build your APK. It doesn’t affect the minimum SDK version that your app can run on.
Right click on android directory of flutter project and open it using this menu: Flutter > Open android module in android studio
In the newly opened project, from menus select Refactor > Migrate to AdnroidX
Close the project and open your flutter project again.