【问题标题】:Couldn't load memtrack module Logcat Error无法加载 memtrack 模块 Logcat 错误
【发布时间】:2014-03-25 08:57:58
【问题描述】:

我在运行时收到错误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>

输出:

最后它显示空白屏幕。

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

【问题讨论】:

  • 您的问题解决了吗?
  • @Cocorico 不,我还没有解决这些问题。你知道吗?
  • 我认为你有一个 OpenGL 的 pb。你用的是模拟器还是物理设备?
  • @Cocorico 我正在使用模拟器。
  • @user2450263 这对我没用

标签: android logcat stack-trace


【解决方案1】:

这个错误,你可以在the question linked in comments above 上看到,结果是:

“[...] 加载 {some} 个硬件模块时出现问题。这可能与 GPU 支持、sdcard 处理等有关。”

下面的步骤 1 应该可以解决此问题。另外,正如我所见,您的清单中有一些奇怪的包名:

  • package="com.example.hive"&lt;manifest&gt; 标签中,
  • android:name="com.sit.gems.app.GemsApplication" 对于&lt;application&gt;
  • android:name="com.sit.gems.activity"&lt;activity&gt;

如您所知,这些事情不会阻止您的应用被展示。但我认为:

Couldn't load memtrack module error 可能由于模拟器配置问题而出现,并且由于您的项目包含许多组织问题,因此重新设计可能会有所帮助。

为了更好地使用和减少事情,可以通过以下提示来解决这个问题:


1。尝试其他模拟器...

甚至是真正的设备! memtrack module 错误似乎与您的模拟器有关。所以改成Run configuration,别忘了也改成API


2。 OpenGL 错误日志

对于OpenGl 错误,如called unimplemented 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。启动画面?

最后,我不太清楚你SplashScreenActivity的目的。它设置一个内容视图并直接完成。这是没用的。

由于它的名字是 Splash Screen,我假设您想在启动 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();
    }
}  

我希望这些技巧能帮助你实现你想要的。
如果不是这种情况,请告诉我如何帮助您。

【讨论】:

  • 我正在使用TabHost in layout_home.xml
  • 为什么你在 SplashScreenActivity 中什么都没有?此活动显示您的 TabHost?
  • 我再说一遍我不确定,但你应该至少尝试 1、2 和 4。希望这会有所帮助!
  • 你确定。我正在尝试。稍后会告诉你结果。
  • 我得到了一个输出。你的回答对我很有帮助。你很棒。我按照你说的做了。最后我创建并添加了一个名为 blogSelected 的方法。这些项目与显示博客有关。我认为错过该方法是我的错误。如果我没有按照你说的那样更改包名称,我无法获得输出。你的回答真的很有帮助对我来说。谢谢你。祝你有美好的一天。
【解决方案2】:

我有同样的错误。创建具有适当 API 级别的新 AVD 解决了我的问题。

【讨论】:

    【解决方案3】:

    我遇到了同样的问题,但是当我将 AVD 设备的皮肤更改为 HVGA 时,它可以工作。

    【讨论】:

      【解决方案4】:

      有时可能是因为简单的问题。

      这是我的情况:

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

      我的案例解决方案:

      1. 在 App 中更新数据模型。
      2. 在 Android Studio 上点击“清理项目”
      3. 在 Android Studio 上点击“重建项目”
      4. 完成。

      【讨论】:

        【解决方案5】:

        您是否调用了 ViewTreeObserver 而没有将其删除。

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

        【讨论】:

          【解决方案6】:

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

          无论如何,我通过在模拟器上增加 RAM 消除了该消息。

          【讨论】:

            猜你喜欢
            • 2018-06-06
            • 1970-01-01
            • 1970-01-01
            • 2015-11-22
            • 1970-01-01
            • 2014-06-04
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多