无法加载 memtrack 模块 Logcat 错误

问题描述 投票:0回答:6

我在运行时遇到错误

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>

输出:

最后它显示空白屏幕。

enter image description here

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

android logcat stack-trace
6个回答
55
投票

这个错误,你可以阅读上面评论中链接的问题,结果是:

[...] 加载 {some} 硬件模块时出现问题。这可能与 GPU 支持、SD 卡处理,基本上任何事情有关。”

下面的步骤 1 应该可以解决这个问题。正如我所看到的,您的清单中有一些奇怪的包名称:

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

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

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
中的所有标签声明不同的包名。你应该对
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 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();
    }
}  

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


5
投票

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


0
投票

我遇到了同样的问题,但是当我将 AVD 设备的外观更改为 HVGA 时,它起作用了。


0
投票

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

这是我的案例:

在项目中,我们使用 KotlinDI 以及 Dagger2。我们的数据模型类在 API 中发生了变化。但是,我们忘记在应用程序端更新它。因此,我有同样的错误是memtrack:无法加载memtrack模块.

我的案例解决方案:

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

-2
投票

你调用了 ViewTreeObserver 而不是删除它。

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

-2
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.