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

error on compile :assets_audio_player:compileDebugKotlin'. #399

Closed
robertoltrocha opened this issue Nov 12, 2020 · 40 comments
Closed

error on compile :assets_audio_player:compileDebugKotlin'. #399

robertoltrocha opened this issue Nov 12, 2020 · 40 comments
Assignees
Labels
bug Something isn't working

Comments

@robertoltrocha
Copy link

Hi,
I can not compile my project because the issue below, someone could help me please?

e: C:\Users\rocha\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\assets_audio_player-2.0.13+1\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (542, 5): 'handleMessage' overrides nothing
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\assets_audio_player-2.0.13+1\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (543, 29): Type mismatch: inferred type is Message? but Message was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\assets_audio_player-2.0.13+1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (12, 85): Type mismatch: inferred type is String? but String was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\assets_audio_player-2.0.13+1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (30, 39): Type mismatch: inferred type is Intent? but Intent was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assets_audio_player: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 26s
Exception: Gradle task assembleDebug failed with exit code 1

assets_audio_player: ^2.0.13+1

Flutter is already up to date on channel stable
Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8874f21e79 (13 days ago) • 2020-10-29 14:14:35 -0700
Engine • revision a1440ca392
Tools • Dart 2.10.3
@robertoltrocha robertoltrocha added the bug Something isn't working label Nov 12, 2020
@robertoltrocha robertoltrocha changed the title error on compile error on compile :assets_audio_player:compileDebugKotlin'. Nov 12, 2020
@imSaharukh
Copy link

facing the same problem

@alberduris
Copy link

alberduris commented Nov 22, 2020

Same issue here with Flutter 1.22.4, as also noted in #382.

This is the output for flutter run --debug

Launching lib/main.dart on Android SDK built for x86 in debug mode...
e: /home/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/assets_audio_player-2.0.13+1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationActionReceiver.kt: (30, 39): Type mismatch: inferred type is Intent? but Intent was expected
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':assets_audio_player: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 15s                                                     
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        16.2s
Exception: Gradle task assembleDebug failed with exit code 1

This is the output for flutter doctor -v

[✓] Flutter (Channel stable, 1.22.4, on Linux, locale en_GB.UTF-8)
    • Flutter version 1.22.4 at /home/ablanco061/development/flutter
    • Framework revision 1aafb3a8b9 (9 days ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /home/ablanco061/Android/Sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 2 categories.

Can you give any update on this @florent37?

@kalismeras61
Copy link
Collaborator

kalismeras61 commented Nov 22, 2020

Could you follow below steps ?

flutter clean
rm -rf pubspec.lock .packages .flutter-plugins
flutter pub cache repair
flutter packages get

@alberduris
Copy link

flutter clean:
Deleting build...                                                  191ms
Deleting .dart_tool...                                               1ms
Deleting Generated.xcconfig...                                       1ms
Deleting flutter_export_environment.sh...                            0ms
Deleting .flutter-plugins-dependencies...                            1ms
Deleting .flutter-plugins...                                         0ms
flutter pub cache repair:
Reinstalled 399 packages.
Reactivating devtools 0.9.3+4...
Precompiling executables...
Precompiled devtools:devtools.
Installed executable devtools.
Reactivated 1 package.

Exactly the same issue.

It is also interesting to note that the import line is greyed out, indicating that I could run the app without expliciting the import.

import 'package:assets_audio_player/assets_audio_player.dart';

So this line is not throwing an error even if I remove the import line

final assetsAudioPlayer = AssetsAudioPlayer();

@nagarwa2
Copy link

nagarwa2 commented Nov 23, 2020

Facing same issue. When this will be resolved ? Can't release new version of app. Please fix this

@yelkamel
Copy link

yelkamel commented Nov 25, 2020

@nagarwa2 you have to change your gradle version to this:
from
classpath 'com.android.tools.build:gradle:4.1.1'
to
classpath 'com.android.tools.build:gradle:3.5.3'

Merci @florent37 pour ce package, quand t'as le temps essaye de voir le soucis avec la monter de version. On ne peux plus faire d'application Android en App Bundle sans cette mise à jours, on est obligé de faire un apk ;)

@alberduris
Copy link

That's not a solution. I cannot do that as I rely on 4.1.1 version of gradle for other parts of the application.

@harshmittal2810
Copy link

I am still facing the same problem, @florent37 Can you please update the library. It's very crucial,
Thanks for your help in advance.

@harshmittal2810
Copy link

@nagarwa2 you have to change your gradle version to this:
from
classpath 'com.android.tools.build:gradle:4.1.1'
to
classpath 'com.android.tools.build:gradle:3.5.3'

Merci @florent37 pour ce package, quand t'as le temps essaye de voir le soucis avec la monter de version. On ne peux plus faire d'application Android en App Bundle sans cette mise à jours, on est obligé de faire un apk ;)

This worked but as we need latest version its not recommended.

@leidig54
Copy link

leidig54 commented Dec 5, 2020

I downgraded to 2.0.10 to solve this.

@jjsebastianfuertes
Copy link

any solution so far implementing classpath 'com.android.tools.build:gradle:4.1.1'?

@EgHubs
Copy link

EgHubs commented Jan 3, 2021

any news?

@UsamaSarwar
Copy link

UsamaSarwar commented Jan 6, 2021

This worked for me
Goto file android/build.gradle

// classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:3.5.3'

Goto file pubspec.yaml

dependencies:
  assets_audio_player: ^2.0.10

This will help you in building the app release.
This might save your nights

@EgHubs
Copy link

EgHubs commented Jan 6, 2021

Thanks for your reply, but I already solved that by that solution as someone already said it before, I mean a solution with the same
classpath 'com.android.tools.build:gradle:4.1.1'

@DomingoMG
Copy link

I have the same problem.

You should update the repository, this way we are limited.

classpath 'com.android.tools.build:gradle:4.1.1'
NOT
classpath 'com.android.tools.build:gradle:3.5.3'

@bibali1980
Copy link

1- download the package from here : https://github.com/florent37/Flutter-AssetsAudioPlayer
2- extract it in the same folder of your app and rename the extracted folder to : assets_audio_player
3- in this file : assets_audio_player\pubspec.yaml
*comment: #assets_audio_player_web: ^2.0.13+2
*comment: #web:
#default_package: assets_audio_player_web
4- in this file: assets_audio_player\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt
*just add !! at the end of this line: var intent : Intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
*it well be : var intent : Intent = context.packageManager.getLaunchIntentForPackage(context.packageName)!!
5- in your app pubspec.yaml add under dependencies:
#assets_audio_player: ^2.0.13+1
assets_audio_player:
path: ../assets_audio_player/

@ianldgs
Copy link

ianldgs commented Jan 22, 2021

1- download the package from here : https://github.com/florent37/Flutter-AssetsAudioPlayer
2- extract it in the same folder of your app and rename the extracted folder to : assets_audio_player
3- in this file : assets_audio_player\pubspec.yaml
*comment: #assets_audio_player_web: ^2.0.13+2
*comment: #web:
#default_package: assets_audio_player_web
4- in this file: assets_audio_player\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt
*just add !! at the end of this line: var intent : Intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
*it well be : var intent : Intent = context.packageManager.getLaunchIntentForPackage(context.packageName)!!
5- in your app pubspec.yaml add under dependencies:
#assets_audio_player: ^2.0.13+1
assets_audio_player:
path: ../assets_audio_player/

Why not make a PR on this repository with this change you're describing?

@robertoltrocha
Copy link
Author

Hi,
Please,
any official solution? new version?
For now, I had to remove the plugin due to the priority need for the update to classpath 'com.android.tools.build:gradle:4.1.1'
Thank you

@kalismeras61
Copy link
Collaborator

kalismeras61 commented Jan 31, 2021

Please use latest version with commit id.

assets_audio_player:
git:
url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git
ref: b49a4360f6a7f182d4a6e23ebcdbf43ad570913b

@kalismeras61
Copy link
Collaborator

I am closing for now. Please let me know, if it is not working.

@robertoltrocha
Copy link
Author

Hi,
I installed the plugin again and I still have the same problem.

e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (542, 5): 'handleMessage' overrides nothing
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (543, 29): Type mismatch: inferred type is Message? but Message was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\CustomMediaButtonReceiver.kt: (15, 35): Type mismatch: inferred type is String? but String was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (12, 85): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assets_audio_player: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 1m 6s
Exception: Gradle task assembleDebug failed with exit code 1

@kalismeras61
Copy link
Collaborator

Delete the pubspec.lock file then run the command flutter pub get again.

@robertoltrocha
Copy link
Author

Hi @kalismeras61,
Unsuccessfully.
I am using: classpath 'com.android.tools.build:gradle:4.1.1'
Steps:

  • Delete pubspec.lock
  • flutter clean
  • invalidate and restart
  • flutter pub get
  • run
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (542, 5): 'handleMessage' overrides nothing
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (543, 29): Type mismatch: inferred type is Message? but Message was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\CustomMediaButtonReceiver.kt: (15, 35): Type mismatch: inferred type is String? but String was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (12, 85): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assets_audio_player: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 13s
Exception: Gradle task assembleDebug failed with exit code 1

@kalismeras61
Copy link
Collaborator

There is a problem with your pub cache . Can you remove all assets player in pub cache folder ? and then run flutter pub get

@robertoltrocha
Copy link
Author

Hi @kalismeras61,

same issue yet.

I removed everything in my folder cache and subfolders with relationship assests_audio.

C:\Users\rocha\AppData\Roaming\Pub\Cache\

and after that:
Steps:
-Delete pubspec.lock
-flutter clean
-invalidate and restart
-flutter pub get
-run

e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (542, 5): 'handleMessage' overrides nothing
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (543, 29): Type mismatch: inferred type is Message? but Message was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\CustomMediaButtonReceiver.kt: (15, 35): Type mismatch: inferred type is String? but String was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-cba4cb34e9263f96dcaa71118b39590630f077a4\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (12, 85): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assets_audio_player: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 12s
Exception: Gradle task assembleDebug failed with exit code 1

@kalismeras61
Copy link
Collaborator

Can you show how are you import to package in your pubspec.yaml file ?

@robertoltrocha
Copy link
Author

robertoltrocha commented Jan 31, 2021

Sure.
There is my all pubspec.yaml

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  url_launcher: 5.7.10
  cached_network_image: 2.5.0
  http: 0.12.2
  awesome_dialog: 1.3.1
  #flutter_masked_text: 0.8.0
  card_settings: ^1.16.2
  flutter_launcher_icons: 0.8.1
  flutter_svg: 0.19.1
  #soundpool: 1.1.3
  progress_indicators: 0.1.5 #texto pulando
  auto_size_text: 2.1.0
  shared_preferences: 0.5.12+4
  expandable: 4.1.4
  #assets_audio_player: 2.0.13+1
  assets_audio_player:
    git:
      url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git
      ref: master


dev_dependencies:

  icapps_license: 0.0.6
  flutter_test:
    sdk: flutter
  build_runner: 1.10.11
  flutter_driver:
    sdk: flutter
  #pedantic: 1.8.0


flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/logo_3.jpg"

flutter:
  uses-material-design: true
  fonts:
    - family: Samsung
      fonts:
        - asset: fonts/SamsungSans-Bold.ttf
          weight: 700

  assets:
    - assets/images/
    - assets/sounds/
    - assets/images/leds/
  #   - images/a_dot_ham.jpeg

@kalismeras61
Copy link
Collaborator

I did some changes in another branch. Can you test with this. Please do flutter clean remove pubspec.lock file and import package run flutter pub get.

 assets_audio_player:
    git:
      url: https://github.com/florent37/Flutter-AssetsAudioPlayer.git
      ref: fix-building

@robertoltrocha
Copy link
Author

Hi @kalismeras61,

same issue yet.

I removed again everything in my folder cache and subfolders with relationship assests_audio.

C:\Users\rocha\AppData\Roaming\Pub\Cache\

and after that:
Steps:
-Delete pubspec.lock
-flutter clean
-invalidate and restart
-flutter pub get
-run

e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-a8e5083f10b2aa8482f586d00af1349ca19c183a\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (542, 5): 'handleMessage' overrides nothing
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-a8e5083f10b2aa8482f586d00af1349ca19c183a\android\src\main\kotlin\com\github\florent37\assets_audio_player\Player.kt: (543, 29): Type mismatch: inferred type is Message? but Message was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-a8e5083f10b2aa8482f586d00af1349ca19c183a\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\CustomMediaButtonReceiver.kt: (15, 35): Type mismatch: inferred type is String? but String was expected
e: C:\Users\rocha\AppData\Roaming\Pub\Cache\git\Flutter-AssetsAudioPlayer-a8e5083f10b2aa8482f586d00af1349ca19c183a\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationActionReceiver.kt: (12, 85): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':assets_audio_player: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 26s
Exception: Gradle task assembleDebug failed with exit code 1

@kalismeras61
Copy link
Collaborator

kalismeras61 commented Jan 31, 2021

Can yıu change like below in your app / build.gradle

compileSdkVersion 29 and targetSdkVersion 29

@robertoltrocha
Copy link
Author

Hi, @kalismeras61 ,
I was using:

  • minSdkVersion 22
  • targetSdkVersion 30
  • compileSdkVersion 30

good news: I changed evertthing to 29 and work well with debug mode.
I will need to do more tests.

  • publish
  • do a test with mobiles
  • I am using S-10+ with android 10
  • to do a test setting with:
    -- minSdkVersion 22
    -- targetSdkVersion 29
    -- compileSdkVersion 29

@kalismeras61
Copy link
Collaborator

Cool . I am glad to hear that. Please do test and let me know.

@robertoltrocha
Copy link
Author

Hi, @kalismeras61,

I published it with version 22 and 29 and it passed, but I will only be able to do tests on the physical mobile tomorrow.
I returned the configuration to minSDK22 and targetSDK30 and again I had the same error. It seems that the problem is when we use the sdk30.

@offline-first
Copy link
Contributor

Same issue with targetSdkVersion 30

@robertoltrocha
Copy link
Author

Hi @offline-first,
I'm temporarily using targetSDK 29 and not 30. With that, everything worked.

@abbasDD
Copy link

abbasDD commented Feb 8, 2021

also, work by changing
classpath 'com.android.tools.build:gradle:4.1.2'
to
classpath 'com.android.tools.build:gradle:3.5.3'
but downgrade isn't the best solution, @florent37 @kalismeras61 kindly make it available for the latest versions also, thanks in advance

@dfields186
Copy link

I just followed all the steps robertoltrocha outlined and I'm still failing to compile. Is there any working solution to this issue? If not, I'm going to just need to look for a different flutter package which plays mp3s.

Thanks!

@CheddersGroup
Copy link

CheddersGroup commented Nov 16, 2021

I had this same problem.

what i did was to downgrade classpath from

classpath 'com.android.tools.build:gradle:4.1.1'
down to
classpath 'com.android.tools.build:gradle:3.5.3'

and i had my project build, this may not work for you tho

@Amr1440
Copy link

Amr1440 commented Nov 21, 2021

Same issue and non of the above solutions worked

@Sherlock-White
Copy link

I tried to change gradle's version from 4.4.1 to 3.5.3, but it did not work.
And I also tried to change assets_audio_player's version to what is mentioned above, but it still did not work.
I found my targetSdkVersion is bound to flutter.targetSdkVersion, so I tried to uninstall my flutter and downloaded flutter_windows_2.10.3-stable, and it works!! (although it still have some warnings about assets_audio_player, but now I can run the app on my pad for testing).
Hope this may work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests