altera2015 / usbserial

Flutter Android USB Serial plugin
BSD 3-Clause "New" or "Revised" License
125 stars 84 forks source link

Fixed build.gradle for newer android/gradle #102

Closed ChaseGuru closed 6 months ago

ChaseGuru commented 7 months ago

In my environment compiling with anything greater than 0.4.0 of usbserial causes this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':usb_serial:generateReleaseBuildConfig'.
> Error while evaluating property 'namespace' of task ':usb_serial:generateReleaseBuildConfig'
   > Failed to calculate the value of task ':usb_serial:generateReleaseBuildConfig' property 'namespace'.
      > Failed to calculate the value of property 'namespace'.
         > Package Name not found in /home/my_user/.pub-cache/hosted/pub.dev/usb_serial-0.5.1/android/src/main/AndroidManifest.xml, and namespace not specified. Please specify a namespace for the generated R and BuildConfig classes via android.namespace in the module's build.gradle file like so:

           android {
               namespace 'com.example.namespace'
           }

* 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 3s
Running Gradle task 'assembleRelease'...                            3.8s
Gradle task assembleRelease failed with exit code 1

This fixes that error.

If this is not merged, you can use this fork like:

  usb_serial:
    git:
      url: https://github.com/ChaseGuru/usbserial.git
ChaseGuru commented 7 months ago

@altera2015 This may be very easy for you to merge (and may fix issues for many people)

altera2015 commented 6 months ago

Thanks @ChaseGuru