Skyost / Bonsoir

A Zeroconf library that allows you to discover network services and to broadcast your own. Based on Apple Bonjour and Android NSD.
http://bonsoir.skyost.eu/
Other
107 stars 49 forks source link

Error "Namespace not specified. Please specify a namespace in the module's build.gradle file like so" when building example #52

Closed Gnitry closed 1 year ago

Gnitry commented 1 year ago

Summary When trying to build the example, error occurs:

PS C:\sources\Bonsoir\bonsoir\example> flutter run
Launching lib\main.dart on SM A336E in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':device_info'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

     android {
         namespace 'com.example.namespace'
     }

     If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

* 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 1s
Running Gradle task 'assembleDebug'...                           1,997ms
Exception: Gradle task assembleDebug failed with exit code 1

To Reproduce

  1. Clone repository
  2. Go to bosoir/example
  3. Execute flutter run
  4. See error

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.4, on Microsoft Windows [Version 10.0.22621.1778], locale en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4)
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.2)
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.79.0)
[✓] Connected device (2 available)
[✓] Network resources
Gnitry commented 1 year ago

I cloned repository again, tried to build, but got this error:

PS C:\sources\Bonsoir\bonsoir\example> flutter run                                                                  
Resolving dependencies... (1.1s)
  collection 1.17.1 (1.17.2 available)
+ device_info_plus 9.0.2
+ device_info_plus_platform_interface 7.0.0
+ ffi 2.0.2
+ file 7.0.0
+ flutter_web_plugins 0.0.0 from sdk flutter
  material_color_utilities 0.2.0 (0.5.0 available)
+ win32 5.0.3
+ win32_registry 1.1.1
These packages are no longer being depended on:
- device_info 2.0.3
- device_info_platform_interface 2.0.1
Changed 9 dependencies!
Launching lib\main.dart on SM A336E in debug mode...
Upgrading build.gradle
Incorrect package="fr.skyost.bonsoir_example" found in source AndroidManifest.xml: C:\sources\Bonsoir\bonsoir\example\android\app\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="fr.skyost.bonsoir_example" from the source AndroidManifest.xml: C:\sources\Bonsoir\bonsoir\example\android\app\src\main\AndroidManifest.xml.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Incorrect package="fr.skyost.bonsoir_example" found in source AndroidManifest.xml: C:\sources\Bonsoir\bonsoir\example\android\app\src\main\AndroidManifest.xml.
  Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
  Recommendation: remove package="fr.skyost.bonsoir_example" from the source AndroidManifest.xml: C:\sources\Bonsoir\bonsoir\example\android\app\src\main\AndroidManifest.xml.

* 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 15s
Running Gradle task 'assembleDebug'...                             76.4s
Exception: Gradle task assembleDebug failed with exit code 1

After I removed package from AndroidManifest, another error appeared (about minSdkVersion).

After setting minSdkVersion to 19, another error appeared:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bonsoir_android:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
Skyost commented 1 year ago

Just updated and tested the example app. It should work now.

Gnitry commented 1 year ago

Yes. Thanks!