无法加载memtrack模块 Logcat错误

92

我在运行时遇到了一个错误Couldn't load memtrack module (No such file or directory) failed to load memtrack module: -2

堆栈跟踪错误:

 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>

输出:

最终它会显示一个空白屏幕。

enter image description here

有人知道如何解决这些错误吗?


2
你解决了你的问题吗? - Cocorico
@Cocorico,它还没有解决这些问题。你知道吗? - Stephen
我认为你在使用OpenGl时遇到了问题。你是使用模拟器还是物理设备? - Cocorico
@Cocorico 我正在使用模拟器。 - Stephen
2
@user2450263,那对我没有帮助。 - Stephen
显示剩余22条评论
6个回答

55

如您在上面评论中链接的问题中所读到的,这个错误的结果是:

"[...] 加载某些硬件模块时出现问题。这可能与GPU支持、sdcard处理或其他任何事情有关。"

下面的步骤1应该解决这个问题。同时我注意到,您的清单文件中有一些奇怪的包名:

  • <manifest>标签中的package="com.example.hive"
  • <application>中的android:name="com.sit.gems.app.GemsApplication"
  • <activity>中的android:name="com.sit.gems.activity"

正如您所知,这些东西并不会影响您的应用程序显示。但我认为:

无法加载memtrack模块错误可能是由于模拟器配置问题引起的,并且由于您的项目存在许多组织问题,重新设计可能会有所帮助。

为了更好地使用,并解决一些问题,可以根据以下提示进行处理:


1. 尝试另一个模拟器...

甚至可以使用真实设备!memtrack 模块错误似乎与您的模拟器有关。因此,请在运行配置中更改它,不要忘记同时更改API


2. OpenGL错误日志

对于OpenGl错误,如调用未实现的OpenGL ES API,这不是一个错误,而是一种声明!您应该在清单文件中启用它(如果您正在HomeActivity.java中使用GLSurfaceView,则可以阅读this answer,它可能会帮助您):

<uses-feature android:glEsVersion="0x00020000"></uses-feature>  
// or
<uses-feature android:glEsVersion="0x00010001" android:required="true" />

3. 使用相同的包名

不要为Manifest中的所有标签声明不同的包名。您应该为ManifestActivities等使用相同的包名。类似以下内容看起来是正确的:

<!-- 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. 启动画面?

最后,我并不清楚您的的目的。它设置了一个内容视图然后直接结束。这是无用的。

由于其名称是启动画面,我假设您想在启动之前显示一个屏幕。因此,您应该这样做而不使用布局 ;):

// 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();
    }
}  

我希望这些技巧能够帮助您实现您想要的目标。
如果不是这样,请告诉我如何帮助您。


我再说一遍,我不确定但你应该至少尝试1、2和4。希望这可以帮到你! - Blo
也许这些问题已经被其他人解决了,但我认为还是要给这些问题点个赞。 - Stephen
谢谢你的指导,我也感谢你的帮助 :) - Stephen
我不知道我能否解决这些错误。但是我必须尝试直到得到结果。 - Stephen
1
我得到了一个输出。你的答案对我很有帮助,你真棒。我按照你说的做了。最后,我创建并添加了一个名为blogSelected的方法。这个项目是用来显示博客的。我认为错过了那个方法是我的错误。如果我没有像你说的那样改变包名,我就无法得到输出。你的答案真的对我很有帮助。谢谢你。祝你有美好的一天。 - Stephen
显示剩余11条评论

7

我遇到了相同的错误。创建一个具有相应API级别的新AVD解决了我的问题。


0

我遇到了同样的问题,但当我将AVD设备的皮肤更改为HVGA时,它就解决了。


0

有时候这是一个简单的问题。

这就是我的情况:

在该项目中,我们使用 KotlinDI 以及 Dagger2。我们的数据模型类在 API 中发生了变化。但是,我们忘记在应用程序端更新它。因此,我遇到了同样的错误,即 memtrack: Couldn't load memtrack module

我的解决方案:

  1. 在应用程序中更新数据模型。
  2. 在 Android Studio 上单击 "Clean Project"
  3. 在 Android Studio 上单击 "Rebuild Project"
  4. 完成。

-2

我也遇到了这个问题,同样是在模拟器上运行。Logcat 上显示了相同的消息,但它并没有影响应用程序的功能。但是这很烦人,我不喜欢看到我不理解的日志错误。

无论如何,我通过增加模拟器的 RAM来摆脱了这个消息。


-2

你调用了ViewTreeObserver却没有移除它。

    mEtEnterlive.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
         // do nothing here can cause such problem
    });

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接