# Script pour ajouter les namespaces manquants aux packages Flutter Write-Host "=== CORRECTION DES NAMESPACES ===" -ForegroundColor Cyan Write-Host "" $pubCache = "$env:LOCALAPPDATA\Pub\Cache\hosted\pub.dev" # Liste des packages à corriger avec leurs namespaces $packages = @{ "flutter_bcrypt*" = "be.appmire.flutter_bcrypt" "flutter_vibrate*" = "com.benjaminabel.flutter_vibrate" "loading_icon_button*" = "com.example.loading_icon_button" } $fixed = 0 $alreadyFixed = 0 foreach ($pattern in $packages.Keys) { $namespace = $packages[$pattern] $packagePath = Get-ChildItem -Path $pubCache -Filter $pattern -Directory | Select-Object -First 1 -ExpandProperty FullName if ($packagePath) { $buildGradle = "$packagePath\android\build.gradle" if (Test-Path $buildGradle) { $content = Get-Content $buildGradle -Raw if ($content -notmatch "namespace\s+['`"]") { Write-Host "📦 Correction de $pattern..." -ForegroundColor Yellow # Ajouter le namespace après "apply plugin: 'com.android.library'" $content = $content -replace "(apply plugin: 'com.android.library')", "`$1`n`nandroid {`n namespace '$namespace'`n}" Set-Content $buildGradle -Value $content Write-Host " ✅ Namespace '$namespace' ajouté" -ForegroundColor Green $fixed++ } else { Write-Host " ✓ $pattern déjà corrigé" -ForegroundColor Gray $alreadyFixed++ } } else { Write-Host " ⚠️ build.gradle non trouvé pour $pattern" -ForegroundColor Yellow } } else { Write-Host " ⚠️ Package $pattern non trouvé" -ForegroundColor Yellow } } Write-Host "" Write-Host "=== RÉSUMÉ ===" -ForegroundColor Cyan Write-Host "Packages corrigés: $fixed" -ForegroundColor Green Write-Host "Déjà corrigés: $alreadyFixed" -ForegroundColor Gray Write-Host "" Write-Host "✅ Correction terminée !" -ForegroundColor Green