fengqiangboy / flutter-nordic-dfu

Flutter Nordic dfu
MIT License
109 stars 76 forks source link

Upgrade android embedding #38

Closed TNorbury closed 3 years ago

TNorbury commented 3 years ago

This upgrades the plugin's Android embedding to V2.

I've tested it and everything appears to be hunky-dory.

I also changed the Android package name from com.timeyaa.flutternordicdfu to com.timeyaa.flutter_nordic_dfu as this lines up with the method channel name.

Also added the Flutter Lints pkg and made the change it requested.

closes #37 updated pubspec to close #30

kent-williams commented 3 years ago

I'm currently getting two errors while building this. First

Error:
    Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-53 value=(com.timeyaa.flutter_nordic_dfu_example)
    has a different value=(com.timeyaa.flutter_nordic_dfu_example) declared in main manifest at AndroidManifest.xml:2:5-45
    Suggestion: remove the overlay declaration at AndroidManifest.xml   and place it in the build.gradle:
        flavorName {
            applicationId = "com.timeyaa.flutter_nordic_dfu_example"
        }

I resolve this by just removing the package definition in the AndroidManifest.xml

Second

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
     Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
     Type com.timeyaa.flutter_nordic_dfu.BuildConfig is defined multiple times: /flutter-nordic-dfu/example/build/flutter_nordic_dfu/.transforms/9ed961ef2d2ff20270f5b49725d8bd8f/classes/classes.dex, /flutter-nordic-dfu/example/build/app/intermediates/project_dex_archive/debug/out/com/timeyaa/flutter_nordic_dfu/BuildConfig.dex

I haven't resolved this one yet.

TNorbury commented 3 years ago

Ok, I think I know what I did wrong. Gonna test a fix real quick and push it as soon as I verify that it works.

@kent-williams just wanna confirm, you get this when building the example, correct?

kent-williams commented 3 years ago

Ok, I think I know what I did wrong. Gonna test a fix real quick and push it as soon as I verify that it works.

@kent-williams just wanna confirm, you get this when building the example, correct?

Yes that's correct, apologies should've specified!

TNorbury commented 3 years ago

@kent-williams No worries! I think I fixed it with that last commit, I was able to build the example on my phone, and verified that I was able to DFU something for good measure

Thank you for catching my mistake!

kent-williams commented 3 years ago

Those fixes did it! thank you!