Canardoux / flutter_sound

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

Bug? : AndroidManifest can't compile when installing package flutter_sound #1107

Open Sangiovanni opened 1 month ago

Sangiovanni commented 1 month ago

Discussed in https://github.com/Canardoux/flutter_sound/discussions/1106

Originally posted by **Sangiovanni** October 19, 2024 Hello, I hope I'm reaching the right place to discuss about this. I recently wanted to change form soundPool discontinued package to this one which seems to fit my need. I just have a problem, when I install the package I have this error : ![androidManifestBug1](https://github.com/user-attachments/assets/ee590bf6-e99d-4a92-9510-6e0164e3ca1b) And when I follow the recommandation, This one appear : ![androidManifestBug2](https://github.com/user-attachments/assets/d2b17ef0-84a3-4890-a066-93fb69989f1f) Flutter doctor if needed ![flutterDoctor](https://github.com/user-attachments/assets/0a80e2cb-92c6-4544-8ccb-69cbe36dab65) I would like to know if I can do something to correct this problem since this package seems really close to what I need. Thanks Ludovic
hagen00 commented 1 month ago

I had used an old version of flutter_sound and everything compiled with no problem. When I upgraded to latest 9.16.3, I had to update my AndroidManifest as per the selected answer here: https://github.com/Canardoux/flutter_sound/discussions/1106

Except I had to "replace two tools" <application android:label="My App Name" android:name="${applicationName}" android:icon="@mipmap/launcher_icon" tools:replace="android:icon, android:label">

thanhbao0408 commented 3 weeks ago

I had used an old version of flutter_sound and everything compiled with no problem. When I upgraded to latest 9.16.3, I had to update my AndroidManifest as per the selected answer here: #1106

Except I had to "replace two tools" <application android:label="My App Name" android:name="${applicationName}" android:icon="@mipmap/launcher_icon" tools:replace="android:icon, android:label">

I used your solution and had another error com.android.manifmerger.ManifestMerger2$MergeFailureException.

I had to add this to the manifest node in the main manifest file and then it works.

xmlns:tools="http://schemas.android.com/tools"

My AndroidManifest.xml looks like

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
    <application
        android:label="tooltopia_music_instrument"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        tools:replace="android:icon, android:label">
Larpoux commented 3 weeks ago

I don't really understand what you had to do on Flutter Sound. Please, tell me if I must do something in the product so that everybody will be happy. Of course PR are always welcome,

thanhbao0408 commented 3 weeks ago

I'm reviewing the 9.16.3 source to identify any changes in the AndroidManifest.xml (both internal and dependencies), but so far, I haven't found anything noteworthy. However, with the new 9.16.3 release, we're encountering conflicts when defining android:icon and android:label in the main AndroidManifest.xml. To resolve these conflicts, we now need to use tools:replace.

drunkenQCat commented 2 weeks ago

From the error log, I believe the issue is related to JitPack and the package com.github.jitpack:android-example:1.0.1 it introduced.

I found the dependence in build.gradle:

    implementation 'com.github.canardoux:flutter_sound_core:9.16.3'

I reviewed the code in flutter_sound_core and noticed that the dependency com.github.jitpack:android-example:1.0.1 was introduced at this location.

I'm not entirely sure about the specific purpose of this package, but it seems like it might be a template or placeholder to generate code, and it was added about two months ago by @Larpoux. If this package is no longer necessary or was mistakenly added, could you please take a closer look and consider removing it?

Let me know if you need any further details or assistance!

drunkenQCat commented 2 weeks ago

I don't really understand what you had to do on Flutter Sound. Please, tell me if I must do something in the product so that everybody will be happy. Of course PR are always welcome,

I must say I was a bit surprised by your response to the issue. @Sangiovanni did mention,

I would like to know if I can do something to correct this problem since this package seems really close to what I need.

However, I believe the focus should be on resolving the bug, not on scrutinizing the phrasing of this statement. Narrative language is not code, and the last few sentences are not a function's return value — they are simply a polite inquiry.

Like the person who raised the issue, I went through an in-depth debugging process, which took me three days, because the issue wasn't clear, and the error messages were quite confusing — especially for someone like me who is less familiar with Android development than with Flutter. After thoroughly investigating, I identified flutter_sound as the root cause.When I saw the response, I felt that it missed the point of the issue: the need for fixing a bug, not the user's tone or phrasing.

While @Sangiovanni expressed willingness to help, this isn’t a feature request. And throughout the discussion, there was no negative or "unhappy" tone. It's a bug report, and it's important for the developer to take responsibility for resolving the issue. It would be more productive to focus on fixing the problem rather than getting caught up in the wording.

I hope this can be resolved in a way that benefits everyone. Looking forward to your thoughts!

Larpoux commented 2 weeks ago

I'm not entirely sure about the specific purpose of this package, but it seems like it might be a template or placeholder to generate code, and it was added about two months ago by @Larpoux. If this package is no longer necessary or was mistakenly added, could you please take a closer look and consider removing it?

i don’t remember having added this dependency intentionally. Maybe it’s a mistake from me.

Larpoux commented 2 weeks ago

Change log:

9.12.44

Trying to update gradle (8.10) and Java (22.0) to recent versions. No Succes : keep temporarly the 9.12.0 flutter_sound_core for Android

Flutter Sound 9.12.x was a nightmare for me. What was supposed to be just a simple upgrade turned to be a nightmare. It is not very surprising iIf there are still some mistakes remaining from the process.

Larpoux commented 2 weeks ago

The problem that I am going to have, now, is that I began to merge this PR but it seems that it is incorrect. Actually I don’t have much time to debug this pr, so it is possible that I will have to roll back the merge to do flutter sound maintenance.

Larpoux commented 2 weeks ago

Flutter Sound 9.17.0 is released :

9.17.0

I went through an in-depth debugging process, which took me three days, because the issue wasn't clear, and the error messages were quite confusing

Three days is much work. Thank you very much @drunkenQCat for what you did : all of us, we appreciate your contribution