[这是应用启动时的][1] [这是在打开一个活动或做出一些动作后,记忆保持460mb以上] [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进行4gb ram的测试,即使这样,当改变活动时也会变慢。请帮帮我
答案 0 :(得分:2)
您不应该在应用程序中保留一系列视频。相反,您可以将路径和网址保留在视频文件中,并且一次只能加载一个视频。还尝试使用Picasso或Glide等图像缓存库,它们也会处理大图像的内存问题。