Как исправить размер страницы 16 КБ / ошибку выравнивания ELF во Flutter на Android 14+Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как исправить размер страницы 16 КБ / ошибку выравнивания ELF во Flutter на Android 14+

Сообщение Anonymous »

Акк Flutter не работает на Android 14+ с ошибкой размера страницы 16 КБ после обновления SDK – как исправить выравнивание по 16 КБ?
Каковы необходимые шаги, чтобы сделать приложение Flutter совместимым с Android 14 (размер страницы 16 КБ)?
В частности:
  • Какой Android Gradle Требуются версии плагинов и Gradle?
  • Нужна ли мне конкретная версия NDK?
  • Как исправить проблемы выравнивания встроенной библиотеки .so, возникающие из подключаемых модулей Flutter?
  • Есть ли способ определить, какие зависимость вызывает ошибку 16 КБ?
Мы будем признательны за любые рекомендации или рекомендации по полному устранению проблем с выравниванием 16 КБ во Flutter.
PS C:\abhisek\spay> flutter --version
Flutter 3.32.4 • канал [пользовательская ветка] • неизвестный источник
Framework • версия 6fba2447e9 (8 месяцев назад) • 12.06.2025 19:03:56 -0700
Движок • версия 8cd19e509d (8 месяцев назад) • 12.06.2025 16:30:12 -0700
Инструменты • Dart 3.8.1 • DevTools 2.45.1
app/build.gradle
plugins {
id "com.android.application"
// ...
id "kotlin-android"
// Make sure that you have the Google services Gradle plugin
id 'com.google.gms.google-services'

// Add the Crashlytics Gradle plugin
id "com.google.firebase.crashlytics"
id "dev.flutter.flutter-gradle-plugin" //
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
//apply plugin: 'kotlin-android'
//apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'dev.flutter.flutter-gradle-plugin'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
kotlin {
jvmToolchain(17)
}
android {
namespace 'app.spayindia.com'
compileSdkVersion 36
ndkVersion "29.0.13599879 rc2"

compileOptions {
sourceCompatibility JavaVersion.VERSION_17//changed
targetCompatibility JavaVersion.VERSION_17
coreLibraryDesugaringEnabled true
}

kotlinOptions {
jvmTarget = '17'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
kotlin {
jvmToolchain(17)
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
//added
buildFeatures {
buildConfig = true
}

defaultConfig {
applicationId "app.spayindia.retailer"
// applicationId "app.spayindia.com"
minSdkVersion 24
targetSdkVersion 36
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
ndk {
abiFilters 'arm64-v8a', 'x86_64' // Keep only arm64-v8a for now
}
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {

shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
// signingConfig signingConfigs.release
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"//changed
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' //changed
implementation 'com.google.android.material:material:1.3.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation('com.google.firebase:firebase-analytics') {
exclude module: "play-services-safetynet"
}

//firebase
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-analytics")

//micro atm service

implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.56'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
implementation files('../libs/matm.aar')
implementation files('../libs/mosambeelib.aar')
implementation files('../libs/morefun.jar')

implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okio:okio:1.14.0'

//credopay sdk:3.0.10'
// implementation('in.credopay.payment.sdk:vm30-payment-sdk:3.0.10')
implementation 'in.credopay.payment.sdk:vm30-payment-sarata-sdk:4.0.37'
implementation "org.slf4j:slf4j-android:1.7.36"
}
//added
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "17"
}
}
configurations.all {
exclude group: 'com.google.android.gms', module: 'play-services-safetynet'
}

android/build.gradle
buildscript {
ext.kotlin_version = '2.2.0'//changed
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.5.1' //changed
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://oss.sonatype.org/content/reposi ... -releases/' }

}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module("io.flutter:arm64_v8a_debug") using module("io.flutter:arm64_v8a_debug:1.0.0-8cd19e509d6bece8ccd74aef027c4ca947363095") because "Exclude from Jetifier"
substitute module("io.flutter:armeabi_v7a_debug") using module("io.flutter:armeabi_v7a_debug:1.0.0-8cd19e509d6bece8ccd74aef027c4ca947363095") because "Exclude from Jetifier"
substitute module("io.flutter:x86_debug") using module("io.flutter:x86_debug:1.0.0-8cd19e509d6bece8ccd74aef027c4ca947363095") because "Exclude from Jetifier"
substitute module("io.flutter:x86_64_debug") using module("io.flutter:x86_64_debug:1.0.0-8cd19e509d6bece8ccd74aef027c4ca947363095") because "Exclude from Jetifier"
}
}
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}

settings.gradle

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
id "com.android.application" version "8.5.1" apply false
id "org.jetbrains.kotlin.android" version "2.2.0" apply false
}

include ":app"

pubspec.yaml

name: spayindia
description: Spay India a money response based fintech application service

version: 2.0.0+20

environment:
sdk: '>=3.2.0

Подробнее здесь: https://stackoverflow.com/questions/798 ... android-14
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»