fix: fix failing apk release build
This commit is contained in:
parent
d680030b16
commit
952e82eb08
3 changed files with 24 additions and 20 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 (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.")
|
||||
if (android != null) {
|
||||
|
||||
if (android is BaseExtension) {
|
||||
android.compileSdkVersion(36)
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Isar>((ref) => throw UnimplementedError());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue