tpucci / shake_gesture

0 dependencies Flutter plugin that detects shake gestures on Android and iOS (even on simulators).
MIT License
3 stars 4 forks source link

Bug: `flutter build apk` fails #2

Closed lllttt06 closed 7 months ago

lllttt06 commented 8 months ago

Hi, thank you for providing good a plugin! The problem is I can't build apk by flutter build apk command. The error message is here.

Execution failed for task ':shake_gesture_android:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/tmp/runner/_work/app/app/packages/app/build/shake_gesture_android/intermediates/aapt_friendly_merged_manifests/release/aapt/AndroidManifest.xml:2: AAPT: error: attribute 'package' in <manifest> tag is not a valid Android package name: 'shake_gesture_android'.

I can run app by flutter run command. Maybe you should change shake_gesture_android package name.

jtsimoes commented 8 months ago

I'm having this issue too. Seems like the problem is the invalid package name, as @lllttt06 said.

I'm not sure but changing this value https://github.com/tpucci/shake_gesture/blob/717042704baa58c8439d2022f3cf52ddcc422c73/shake_gesture_android/android/src/main/AndroidManifest.xml#L1 to shake_gesture_android.example, might solve this issue.

I think it needs to be the same as the value from build.gradle: https://github.com/tpucci/shake_gesture/blob/717042704baa58c8439d2022f3cf52ddcc422c73/shake_gesture/example/android/app/build.gradle#L45

Source: https://stackoverflow.com/a/55611819

dhikshithrm commented 7 months ago

did it work after changing the manifest package name?

jtsimoes commented 7 months ago

I couldn't, when I built it, it overwrote what I had changed. Had to use another package

tpucci commented 7 months ago

Hello there ! Sorry, I have disabled the notifications for Christmas but did not enable them again after 😅 I'll fix that this weekend 🙂 Happy to see this package is used by the community

dhikshithrm commented 7 months ago

Thanks so much @tpucci for developing this package, i left a like on pub.dev and star here on github if that motivates you 😅

tpucci commented 7 months ago

Should be fixed in 1.0.1 ✅ You can update this dependency. Feel free to reopen if there is still an issue 🙂


If you want a workaround for the previous version, try this snippet in the root build.gradle:

// Fixes "Namespace not specified." errors.
subprojects {
    afterEvaluate { project ->
        if (project.hasProperty('android')) {
            project.android {
                if (namespace == null) {
                    namespace project.group
                }
            }
        }
    }
}