# Fix Flutter Android build: AGP 8.x namespace issue with old device_info package # Run AFTER: flutter create --project-name voidea_app --org com.voidea . # Сценарий: ищет device_info-2.0.3 в pub-cache и патчит build.gradle param ( [string]$PubCachePath = "$env:USERPROFILE\AppData\Local\Pub\Cache" ) Write-Host "Fixing device_info namespace for AGP 8+..." -ForegroundColor Cyan $deviceInfoDir = Get-ChildItem -Path "$PubCachePath\hosted\pub.dev" -Directory -Filter "device_info-*" | Sort-Object Name -Descending | Select-Object -First 1 if (-not $deviceInfoDir) { Write-Host "device_info not found in pub cache. Run flutter pub get first." -ForegroundColor Yellow exit 1 } $buildGradle = Join-Path $deviceInfoDir.FullName "android\build.gradle" if (-not (Test-Path $buildGradle)) { Write-Host "build.gradle not found at $buildGradle" -ForegroundColor Red exit 1 } $content = Get-Content $buildGradle -Raw if ($content -match "namespace\s+") { Write-Host "namespace already set in $buildGradle" -ForegroundColor Green } else { $fixed = $content -replace "(android\s*\{)", "`$1`n namespace 'com.voidea.app'" Set-Content -Path $buildGradle -Value $fixed Write-Host "Patched namespace in $buildGradle" -ForegroundColor Green } Write-Host "Done. Run 'flutter run' now." -ForegroundColor Cyan