diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 573ab75..edaa69a 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,12 +9,12 @@ android { compileSdk = 36 compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "17" } defaultConfig { diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 8a87c7b..ec73678 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.gradle.BaseExtension + buildscript { repositories { google() @@ -24,23 +26,29 @@ subprojects { } subprojects { - // 1. Fix ZUERST registrieren (bevor das Projekt evaluiert wird) afterEvaluate { - // Prüfen, ob das Subprojekt eine Android-Erweiterung hat (Library oder App) val android = project.extensions.findByName("android") + if (android != null) { - // Wir versuchen, auf die 'namespace'-Eigenschaft zuzugreifen. - // Da wir hier im Root-Skript sind und die Typen dynamisch sind, nutzen wir Reflection/Dynamik. - try { - val namespaceProp = android.javaClass.getMethod("getNamespace") - val currentNamespace = namespaceProp.invoke(android) + + if (android is BaseExtension) { + android.compileSdkVersion(36) + } - if (currentNamespace == null) { - // Wenn kein Namespace gesetzt ist, setzen wir ihn auf den Gruppennamen oder Package-Namen - val setNamespace = android.javaClass.getMethod("setNamespace", String::class.java) - val newNamespace = project.group.toString() - setNamespace.invoke(android, newNamespace) - println("FIX: Namespace für '${project.name}' auf '$newNamespace' gesetzt.") + try { + val androidClass = android.javaClass + + try { + val namespaceProp = androidClass.getMethod("getNamespace") + val currentNamespace = namespaceProp.invoke(android) + + if (currentNamespace == null) { + val setNamespace = androidClass.getMethod("setNamespace", String::class.java) + val newNamespace = project.group.toString() + setNamespace.invoke(android, newNamespace) + println("FIX: Namespace für '${project.name}' auf '$newNamespace' gesetzt.") + } + } catch (e: NoSuchMethodException) { } } catch (e: Exception) { println("WARNUNG: Konnte Namespace für ${project.name} nicht automatisch setzen: $e") @@ -48,7 +56,6 @@ subprojects { } } - // 2. DANACH erst die Abhängigkeit zur App definieren project.evaluationDependsOn(":app") } diff --git a/lib/main.dart b/lib/main.dart index 4d578ca..2790be2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,13 +12,11 @@ import 'src/shared/data/local/collections/workout_collection.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); - // Lock orientation to portrait await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); - // Initialize Isar database final dir = await getApplicationDocumentsDirectory(); final isar = await Isar.open( [UserCollectionSchema, CycleCollectionSchema, WorkoutCollectionSchema], @@ -34,5 +32,4 @@ void main() async { ); } -// Global Isar provider final isarProvider = Provider((ref) => throw UnimplementedError());