我在运行时得到一个错误Couldn't load memtrack module (No such file or directory) failed to load memtrack module: -2
。
StackTrace错误:
E/SoundPool(1280) : error loading /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool(1280) : error loading /system/media/audio/ui/KeypressStandard.ogg
E/SurfaceFlinger(931) : glCheckFramebufferStatusOES error 733995180
E/memtrack(1873) : Couldn't load memtrack module (No such file or directory)
E/android.os.Debug(1873): failed to load memtrack module: -2
E/libEGL(931) : called unimplemented OpenGL ES API
E/libEGL(931) : called unimplemented OpenGL ES API
E/libEGL(931) : called unimplemented OpenGL ES API
E/libEGL(931) : called unimplemented OpenGL ES API
E/SurfaceFlinger(931) : glCheckFramebufferStatusOES error 733995180
E/SurfaceFlinger(931) : got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL(931) : called unimplemented OpenGL ES API
E/libEGL(931) : called unimplemented OpenGL ES API
宣言:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hive"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:name="com.sit.gems.app.GemsApplication"
android:theme="@style/AppTheme" >
<activity
android:name="com.sit.gems.activity.SplashActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.sit.gems.activity.HomeActivity" android:screenOrientation="portrait"></activity>
</application>
</manifest>
SplashActivity.java:
package com.sit.gems.activity;
import com.example.hive.R;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class SplashActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_home);
startActivity(new Intent(SplashActivity.this,HomeActivity.class));
SplashActivity.this.finish();
}
}
layout_home.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@android:id/tabs" >
<FrameLayout
android:id="@+id/tab_home"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="@+id/tab_video"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="@+id/tab_audio"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_blog"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_gal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_more"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/bottom_bar"
android:divider="@null" />
<!-- android:background="#d8e49c" -->
</RelativeLayout>
</TabHost>
</LinearLayout>
输出:
最后,它显示空白屏幕。
有人知道如何解决这些错误吗?
发布于 2014-03-30 14:57:41
正如您可以在the question linked in comments above上看到的那样,此错误的结果如下:
“.加载{某些}硬件模块的问题。这可能与GPU支持、sdcard处理,基本上是任何事情有关。”
下面的步骤1应该解决这个问题。此外,正如我所看到的,您的清单中有一些奇怪的包名:
<manifest>
标签中,<application>
<activity>
)如你所知,这些东西并不妨碍你的应用程序被显示。但我认为:
Couldn't load memtrack module error
可能是由于仿真器配置问题而出现的,而且由于您的项目包含许多组织问题,它可能有助于重新设计。
为了更好地使用和使用很少的东西,可以通过以下技巧来解决这个问题:
1.试试其他模拟器..。
甚至是一个真正的装置!memtrack module
错误似乎与模拟器有关。因此,将其转换为Run configuration
,不要忘记也更改API
。
2. OpenGL错误日志
对于OpenGl
错误,如called unimplemented OpenGL ES API
,它不是一个错误,而是一个语句!您应该在清单中启用它(如果在this answer中使用GLSurfaceView,则可以阅读HomeActivity.java
,这可能对您有所帮助):
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
// or
<uses-feature android:glEsVersion="0x00010001" android:required="true" />
3.使用相同的软件包
不要向Manifest
中的所有标记声明不同的包名。对于Manifest
、Activities
等,您应该拥有相同的内容。类似这样的内容看起来是正确的:
<!-- set the general package -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sit.gems.activity"
android:versionCode="1"
android:versionName="1.0" >
<!-- don't set a package name in <application> -->
<application ... >
<!-- then, declare the activities -->
<activity
android:name="com.sit.gems.activity.SplashActivity" ... >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- same package here -->
<activity
android:name="com.sit.gems.activity.HomeActivity" ... >
</activity>
</application>
</manifest>
4.不要因布局而迷路:
您应该为SplashScreenActivity.java
设置另一个布局,因为您没有在启动屏幕上使用TabHost
,这不是一种安全的资源方法。以不同的方式声明特定的布局,如应用程序名称和徽标:
// inside SplashScreen class
setContentView(R.layout.splash_screen);
// layout splash_screen.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/appname" />
避免在不使用布局的活动中使用布局。
5.溅屏?
最后,我不清楚您的SplashScreenActivity
的目的。它设置一个内容视图并直接完成。这是没用的。
由于它的名称是Splash,我假设您希望在启动HomeActivity
之前显示一个屏幕。因此,您应该这样做,不要使用TabHost
布局;):
// FragmentActivity is also useless here! You don't use a Fragment into it, so, use traditional Activity
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set your splash_screen layout
setContentView(R.layout.splash_screen);
// create a new Thread
new Thread(new Runnable() {
public void run() {
try {
// sleep during 800ms
Thread.sleep(800);
} catch (InterruptedException e) {
e.printStackTrace();
}
// start HomeActivity
startActivity(new Intent(SplashActivity.this, HomeActivity.class));
SplashActivity.this.finish();
}
}).start();
}
}
我希望这类建议能帮助你实现你想要的。
如果不是这样的话,告诉我有什么可以帮你的。
发布于 2014-10-20 07:31:37
我也犯了同样的错误。使用适当的API级别创建一个新的AVD解决了我的问题。
发布于 2014-07-22 04:29:57
我也面临着同样的问题,但是当我把AVD设备的皮肤换成HVGA时,它就起作用了。
https://stackoverflow.com/questions/22629568
复制相似问题