[Это когда приложение запускается] [1] [Это после открытия Activity или выполнения какого-либо действия, объем памяти составляет 460 МБ и более] [2] 2
это мой манифест:
<?xml version = "1.0" encoding = "utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
package = "com.nexttip.personaltrainer">
<!-- Permisos de la aplicaion -->
<uses-permission android:name = "android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name = "android.permission.ACCESS_WIFI_STATE" />
<application
android:allowBackup = "true"
android:hardwareAccelerated = "false"
android:largeHeap = "true"
android:name = "android.support.multidex.MultiDexApplication"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:roundIcon = "@drawable/ic_launcher"
android:supportsRtl = "true"
android:theme = "@style/AppTheme">
<!-- Splash Screen -->
<activity
android:name = ".SplashScreenActivity"
android:label = "@string/app_name"
android:theme = "@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name = "android.intent.action.MAIN" />
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name = ".MainActivity"
android:label = "@string/app_name"
android:theme = "@style/AppTheme.NoActionBar" />
<activity android:name = ".DonateMainLayout" />
<activity android:name = ".VideoListActivity" />
<activity
android:name = ".VideoActivity"
android:screenOrientation = "landscape"
android:theme = "@style/videoPlayer" />
<activity android:name = ".RateActivity" />
<meta-data
android:name = "preloaded_fonts"
android:resource = "@array/preloaded_fonts" />
<activity android:name = ".BMI" />
<activity android:name = ".Result_BMI" />
<activity
android:name = ".Video_Stream"
android:screenOrientation = "landscape"
android:theme = "@style/videoStream" />
<activity
android:name = ".Timer_CountDown"
android:theme = "@style/AppTheme.Transparent" />
<activity
android:name = ".ActivityList1"
android:label = "@string/list1_label" />
<activity
android:name = ".ActivityList2"
android:label = "@string/list2_label" />
<activity
android:name = ".ActivityList3"
android:label = "@string/list3_label" />
<activity
android:name = ".ActivityList4"
android:label = "@string/list4_label" />
<activity
android:name = ".ActivityList5"
android:label = "@string/list5_label">
</activity>
<activity
android:name = ".IntroActivity"
android:label = "@string/intro_title">
</activity>
<activity
android:name = ".TipsActivity"
android:label = "@string/tips_title">
</activity>
<activity android:name = ".DietPlanMain"
android:label = "@string/diet_title">
</activity>
</application>
</manifest>
это мой градл:
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://maven.google.com'
}
}
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.nexttip.personaltrainer"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'com.android.support:support-compat:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
В приложении у меня есть некоторые видео в массиве, а другие загружаются с сервера, я также использую изображения в формате gif и другие ресурсы. Я уже сжал ресурсы, чтобы убедиться, что у меня нет проблем, но при запуске приложения на мобильном телефоне с меньшим радиусом действия оно закрывается с недостаточной ошибкой памяти. Я использую Samung s7 для тестов с 4 ГБ оперативной памяти, и даже в этом случае при изменении активности он замедляется. Пожалуйста, помогите мне
вы не должны хранить массив видео в своем приложении. Вместо этого вы можете сохранить пути и URL-адреса к видеофайлам и загружать только одно видео за раз, которое необходимо для воспроизведения. Также попробуйте использовать библиотеки кеширования изображений, такие как Picasso или Glide, они позаботятся и о проблемах с памятью для больших изображений.