我有一个Flutter应用,该应用在Android和iOS上一直崩溃。
我没有任何堆栈跟踪。该应用程序仅在iOS和Android上最小化。
我只在一段时间后才收到崩溃报告。
我不明白问题是什么。
我认为是由于某些内存问题。
下面是我的Android build.gradle
文件。我正在使用ListView
,在ListView
内加载图像。
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
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.")
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support") {
if (!requested.name.startsWith("multidex")) {
details.useVersion "26.+"
}
}
}
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.xxx.xxx"
minSdkVersion 24
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndk {
abiFilters = []
abiFilters.addAll(ABI_FILTERS.split(';').collect{it as String})
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
def supportLibVersion = rootProject.ext.supportLibVersion
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation "androidx.appcompat:appcompat:$supportLibVersion"
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
我认为问题是您正在使用大尺寸的图像加载到嵌套列表视图中,而我看不到任何数据库,这意味着您正在从应用程序本身静态加载它们。导致由于应用程序占用过多内存而导致内存不足的异常。请从firebase或sql等数据库中加载该内存,或加载分辨率较低的png小图片。希望有帮助。