我的应用程序在模拟器中停止/崩溃(重新安装操作系统后)

时间:2017-11-15 14:15:22

标签: android android-studio

我正在做一些Android课程和部分作业,我必须建立一个模拟音乐播放器应用程序。该应用程序不必具有任何功能,因此它主要是xml代码。 当我尝试在模拟器中运行它时,应用程序不断崩溃,例如:" Vibes已停止"或者" Vibes一直在停止"。

可能重要的是我最近在Mac上重新安装了操作系统(完全擦除了)。我现在正在运行macOS High Sierra。我在HAXM上遇到了一些兼容性问题,但它是通过英特尔在HAXM组件上的最新更新解决的。 安装了Java,所以我不确定这里是否还有其他的东西。

我也尝试过以前工作过的旧项目,并且遇到同样的问题。基于此,我怀疑代码是否存在问题。

任何建议都非常受欢迎! : - )

这是清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alexcojocaru.vibes">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Library"
        android:label="Music Library"/>
    <activity android:name=".Discover"
        android:label="Discover Music"></activity>
</application>

这是正确的日志:

  

11-15 14:45:13.248 10725-10725 / com.example.alexcojocaru.vibes E / AndroidRuntime:FATAL EXCEPTION:main                                                                                   处理:com.example.alexcojocaru.vibes,PID:10725                                                                                   java.lang.RuntimeException:Canvas:尝试绘制太大(144000000bytes)的位图。                                                                                       在android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)                                                                                       在android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)                                                                                       在android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)                                                                                       在android.view.View.getDrawableRenderNode(View.java:19381)                                                                                       在android.view.View.drawBackground(View.java:19317)                                                                                       在android.view.View.draw(View.java:19114)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18073)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18064)                                                                                       在android.view.View.draw(View.java:18851)                                                                                       在android.view.ViewGroup.drawChild(ViewGroup.java:4214)                                                                                       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)                                                                                       在android.view.View.draw(View.java:19126)                                                                                       在com.android.internal.policy.DecorView.draw(DecorView.java:785)                                                                                       在android.view.View.updateDisplayListIfDirty(View.java:18073)                                                                                       在android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:643)                                                                                       在android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:649)                                                                                       在android.view.ThreadedRenderer.draw(ThreadedRenderer.java:757)                                                                                       在android.view.ViewRootImpl.draw(ViewRootImpl.java:2980)                                                                                       在android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2794)                                                                                       在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2347)                                                                                       在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)                                                                                       在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6733)                                                                                       在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:911)                                                                                       在android.view.Choreographer.doCallbacks(Choreographer.java:723)                                                                                       在android.view.Choreographer.doFrame(Choreographer.java:658)                                                                                       在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:897)                                                                                       在android.os.Handler.handleCallback(Handler.java:789)                                                                                       在android.os.Handler.dispatchMessage(Handler.java:98)                                                                                       在android.os.Looper.loop(Looper.java:164)                                                                                       在android.app.ActivityThread.main(ActivityThread.java:6541)                                                                                       at java.lang.reflect.Method.invoke(Native Method)                                                                                       在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                                                       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

1 个答案:

答案 0 :(得分:0)

我认为this帖子可能会对您有所帮助。你似乎在某个地方使用了一个非常大的图像,这个图像太大了,无法在Android画布上绘制。