Initial upload: iptv-android-tv-hermes
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# init_iptv_env.ps1
|
||||
# Initialise l'environnement Android / ADB / Flutter pour le projet IPTV.
|
||||
# À lancer depuis le dossier du projet :
|
||||
# D:\07-Logiciels\12-IPTV Andoid TV HERMES
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Add-ToPathIfExists {
|
||||
param([string]$PathToAdd)
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($PathToAdd)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (Test-Path $PathToAdd) {
|
||||
$parts = $env:Path -split ';'
|
||||
if ($parts -notcontains $PathToAdd) {
|
||||
$env:Path = "$PathToAdd;$env:Path"
|
||||
}
|
||||
Write-Host "PATH OK: $PathToAdd" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Introuvable, ignoré: $PathToAdd" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "=== Initialisation environnement IPTV Android TV ===" -ForegroundColor Cyan
|
||||
|
||||
# Java fourni par Android Studio
|
||||
$env:JAVA_HOME = "D:\Program Files\Android\Android Studio\jbr"
|
||||
Add-ToPathIfExists "$env:JAVA_HOME\bin"
|
||||
|
||||
# Android SDK
|
||||
$env:ANDROID_HOME = "$env:LOCALAPPDATA\Android\Sdk"
|
||||
$env:ANDROID_SDK_ROOT = "$env:LOCALAPPDATA\Android\Sdk"
|
||||
|
||||
Add-ToPathIfExists "$env:ANDROID_HOME\platform-tools"
|
||||
Add-ToPathIfExists "$env:ANDROID_HOME\cmdline-tools\latest\bin"
|
||||
Add-ToPathIfExists "$env:ANDROID_HOME\emulator"
|
||||
|
||||
# Flutter
|
||||
$flutterDefault = "D:\flutter\bin"
|
||||
if (Test-Path $flutterDefault) {
|
||||
Add-ToPathIfExists $flutterDefault
|
||||
} else {
|
||||
Write-Host "Flutter non trouvé dans D:\flutter\bin. Recherche rapide..." -ForegroundColor Yellow
|
||||
$flutterBat = Get-ChildItem -Path "C:\","D:\" -Filter flutter.bat -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if ($flutterBat) {
|
||||
Add-ToPathIfExists $flutterBat.Directory.FullName
|
||||
} else {
|
||||
Write-Host "flutter.bat non trouvé. Ce n'est pas bloquant pour builder l'app Android native." -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# local.properties pour Gradle Android
|
||||
if (Test-Path ".\app") {
|
||||
Set-Content -Path ".\local.properties" -Value "sdk.dir=$($env:LOCALAPPDATA.Replace('\','/'))/Android/Sdk"
|
||||
Write-Host "local.properties écrit :" -ForegroundColor Green
|
||||
Get-Content ".\local.properties"
|
||||
} else {
|
||||
Write-Host "Attention: ce dossier ne ressemble pas à la racine du projet Android. Place-toi dans D:\07-Logiciels\12-IPTV Andoid TV HERMES" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "`n=== Vérifications ===" -ForegroundColor Cyan
|
||||
|
||||
try { java -version } catch { Write-Host "java introuvable" -ForegroundColor Red }
|
||||
try { adb version } catch { Write-Host "adb introuvable" -ForegroundColor Red }
|
||||
try { flutter --version } catch { Write-Host "flutter introuvable ou non nécessaire" -ForegroundColor Yellow }
|
||||
|
||||
Write-Host "`nADB devices :" -ForegroundColor Cyan
|
||||
adb devices
|
||||
|
||||
Write-Host "`nEnvironnement initialisé pour cette fenêtre PowerShell." -ForegroundColor Green
|
||||
Reference in New Issue
Block a user