我试图做很多挖掘,但我无法解决我的这个问题。问题出在我的应用程序的闪屏上。启动画面在除 Google Galaxy Nexus 之外的所有设备/平板电脑上运行没有任何问题。我没有显示启动画面,而是看到一个空白的黑屏,然后我的应用程序的主屏幕打开。
我检查了下面的 logcat,那里有一个看起来像罪魁祸首的警告。
03-26 22:51:34.878: D/dalvikvm(26506): GC_FOR_ALLOC freed 30K, 1% free 8662K/8720K, paused 19ms, total 20ms
03-26 22:51:34.894: I/dalvikvm-heap(26506): Grow heap (frag case) to 12.390MB for 4096016-byte allocation
03-26 22:51:34.917: D/dalvikvm(26506): GC_FOR_ALLOC freed <1K, 1% free 12661K/12724K, paused 20ms, total 20ms
03-26 22:51:34.925: D/dalvikvm(26506): GC_CONCURRENT freed <1K, 1% free 12661K/12724K, paused 2ms+1ms, total 15ms
03-26 22:51:34.996: D/dalvikvm(26506): GC_FOR_ALLOC freed <1K, 1% free 12661K/12724K, paused 9ms, total 10ms
03-26 22:51:35.058: I/dalvikvm-heap(26506): Grow heap (frag case) to 28.013MB for 16384016-byte allocation
03-26 22:51:35.089: D/dalvikvm(26506): GC_FOR_ALLOC freed 0K, 1% free 28661K/28728K, paused 31ms, total 31ms
03-26 22:51:35.128: D/dalvikvm(26506): GC_CONCURRENT freed <1K, 1% free 28661K/28728K, paused 12ms+2ms, total 36ms
03-26 22:51:35.347: I/System.out(26506): true
03-26 22:51:35.503: D/libEGL(26506): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
03-26 22:51:35.535: D/libEGL(26506): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
03-26 22:51:35.542: D/libEGL(26506): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
03-26 22:51:35.917: D/OpenGLRenderer(26506): Enabling debug mode 0
03-26 22:51:36.027: W/OpenGLRenderer(26506): Bitmap too large to be uploaded into a texture (1600x2560, max=2048x2048)
03-26 22:51:36.871: V/CheatsDB.db(26506): db exists
03-26 22:51:37.207: D/dalvikvm(26506): GC_FOR_ALLOC freed 6206K, 18% free 28757K/35028K, paused 14ms, total 14ms
显示“位图太大,无法上传......”的行。我检查了我的drawables,没有那么大尺寸的图像。启动画面使用的背景图像为 800 x 1280。这是我目前在所有设备上使用的唯一 png 图像,并且启动画面在所有其他设备上都可以正常工作。logcat 还说图像的大小看起来像 1600 x 2560,我相信这是我的 Nexus 10 的分辨率。我没有在任何地方添加任何该大小的特定图像。
我还在下面发布了我的 SplashScreen.java 文件代码:
public class SplashScreen extends Activity {
private final int SPLASH_DISPLAY_TIME = 1000;
private Handler splashHandler = new Handler();
private Runnable splashRunnable;
private final String firstLaunchCheck = "firstLaunchCheck";
SharedPreferences mPrefs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash_screen);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
final Boolean isFirstLaunch = mPrefs.getBoolean(firstLaunchCheck, false);
System.out.println(isFirstLaunch);
splashRunnable = new Runnable() {
@Override
public void run() {
if (!isFirstLaunch) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(firstLaunchCheck, true);
editor.commit();
Intent mainIntent = new Intent(SplashScreen.this,
LookItUpTutorial.class);
mainIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(mainIntent);
SplashScreen.this.finish();
}
else {
Intent mainIntent = new Intent(SplashScreen.this,
LandingPage.class);
startActivity(mainIntent);
SplashScreen.this.finish();
}
}
};
splashHandler.postDelayed(splashRunnable, SPLASH_DISPLAY_TIME);
}
// Remove any call back activities when back / home button is pressed on
// SplashScreen
@Override
public void onPause() {
super.onPause();
splashHandler.removeCallbacks(splashRunnable);
SplashScreen.this.finish();
}
}
还添加了我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/appbackground">
</LinearLayout>
谁能给我指点我如何去跟踪这个问题的原因?我相信这与图像大小警告有关,但是我的源代码中没有任何大的图像。任何帮助将不胜感激。
感谢您停下来阅读这篇大文章。