AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
380 stars 499 forks source link

Namespace not specified using gradle 8.4.0 #343

Open latiefdole opened 8 months ago

latiefdole commented 8 months ago

I'm encountering an issue while trying to configure the Flutter Barcode Scanner project. When I try to build the project, I receive the following error message:

A problem occurred configuring project ':flutter_barcode_scanner'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace. I have checked the module's build file, but I'm unsure how to correctly specify the namespace. I have also reviewed the Android documentation provided in the error message, but I'm still having trouble resolving the issue.

Could someone please provide guidance on how to properly set the namespace in the build file? Any help or suggestions would be greatly appreciated.

Thank you in advance for your assistance!

devNamanG commented 7 months ago

I guess since the plugin has not been updated since more than 2 years on pub.dev, it is better to switch to a different plugin like mobile_scanner.

LuisGutierrezArone commented 7 months ago

hola a todos, pude encontrar la solución a ello se que es demasiado tarde esta implementación la he usado en muchas dependencia que aun no es compatible con gradle 8.4.0, yo lo corregí en mi local aunque no es la manera correcta pero con ello solucioné el inconveniente de versión.

Primero debes ir al archivo glader del flutter_barcode_scanner te dejo el código que edité

rootProject.allprojects { repositories { google() //jcenter() mavenCentral() } }

apply plugin: 'com.android.library'

android { if (project.android.hasProperty("namespace")) { namespace 'com.amolg.flutterbarcodescanner' }

compileSdkVersion 30

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 30
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
    disable 'InvalidPackage'
}

}

dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.gms:play-services-vision:20.1.3' }

latiefdole commented 7 months ago

I guess since the plugin has not been updated since more than 2 years on pub.dev, it is better to switch to a different plugin like mobile_scanner.

Ok, thanks for reference

devNamanG commented 6 months ago

@latiefdole Welcome! :)