Freitag, April 10, 2020

Android – merkwürdige Fehler im logcat nicht so dass die app zu laufen

Ich habe Schwierigkeiten zu verstehen, was das problem hier ist. Meine android-app nicht laufen, hier ist der logcat-Ausgabe.

09-26 20:21:35.609    2540-2540/com.example.savag.myapplication I/art Not late-enabling -Xcheck:jni (already on)
09-26 20:21:35.609    2540-2540/com.example.savag.myapplication I/art Late-enabling JIT
09-26 20:21:35.646    2540-2540/com.example.savag.myapplication I/art JIT created with code_cache_capacity=2MB compile_threshold=1000
09-26 20:21:35.749    2540-2540/com.example.savag.myapplication W/System ClassLoader referenced unknown path: /data/app/com.example.savag.myapplication-2/lib/x86
09-26 20:21:36.804    2540-2551/com.example.savag.myapplication I/art Background sticky concurrent mark sweep GC freed 5990(393KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 10MB/10MB, paused 17.760ms total 60.005ms
09-26 20:21:36.886    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:36.886    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:36.906    2540-2540/com.example.savag.myapplication I/art Alloc sticky concurrent mark sweep GC freed 17(848B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.261ms total 18.538ms
09-26 20:21:36.910    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:36.965    2540-2540/com.example.savag.myapplication I/art Alloc partial concurrent mark sweep GC freed 18(784B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.299ms total 54.124ms
09-26 20:21:36.967    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:36.988    2540-2540/com.example.savag.myapplication I/art Alloc concurrent mark sweep GC freed 8(12KB) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.902ms total 19.329ms
09-26 20:21:36.989    2540-2540/com.example.savag.myapplication I/art Forcing collection of SoftReferences for 66MB allocation
09-26 20:21:36.991    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.011    2540-2540/com.example.savag.myapplication I/art Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.322ms total 19.763ms
09-26 20:21:37.013    2540-2540/com.example.savag.myapplication W/art Throwing OutOfMemoryError "Failed to allocate a 70056012 byte allocation with 4194304 free bytes and 46MB until OOM"
09-26 20:21:37.014    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.015    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.032    2540-2540/com.example.savag.myapplication I/art Alloc sticky concurrent mark sweep GC freed 3(560B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.341ms total 15.687ms
09-26 20:21:37.034    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.051    2540-2540/com.example.savag.myapplication I/art Alloc partial concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.313ms total 16.234ms
09-26 20:21:37.053    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.171    2540-2540/com.example.savag.myapplication I/art Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 26.229ms total 116.717ms
09-26 20:21:37.182    2540-2540/com.example.savag.myapplication I/art Forcing collection of SoftReferences for 66MB allocation
09-26 20:21:37.183    2540-2540/com.example.savag.myapplication I/art Starting a blocking GC Alloc
09-26 20:21:37.202    2540-2540/com.example.savag.myapplication I/art Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.250ms total 17.745ms
09-26 20:21:37.205    2540-2540/com.example.savag.myapplication W/art Throwing OutOfMemoryError "Failed to allocate a 70056012 byte allocation with 4194304 free bytes and 46MB until OOM"
09-26 20:21:37.206    2540-2540/com.example.savag.myapplication D/skia --- allocation failed for scaled bitmap
09-26 20:21:37.207    2540-2540/com.example.savag.myapplication D/AndroidRuntime Shutting down VM
09-26 20:21:37.207    2540-2540/com.example.savag.myapplication E/AndroidRuntime FATAL EXCEPTION: main
    Process: com.example.savag.myapplication, PID: 2540
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.savag.myapplication/com.example.savag.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #34: Binary XML file line #34: Error inflating class <unknown>
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.view.InflateException: Binary XML file line #34: Binary XML file line #34: Error inflating class <unknown>
            at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.example.savag.myapplication.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
            at android.view.LayoutInflater.createView(LayoutInflater.java:645)
            at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.example.savag.myapplication.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at android.view.LayoutInflater.createView(LayoutInflater.java:619)
            at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.example.savag.myapplication.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.OutOfMemoryError: Failed to allocate a 70056012 byte allocation with 4194304 free bytes and 46MB until OOM
            at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
            at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
            at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
            at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
            at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
            at android.content.res.Resources.loadDrawableForCookie(Resources.java:2635)
            at android.content.res.Resources.loadDrawable(Resources.java:2540)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
            at android.view.View.<init>(View.java:3948)
            at android.view.ViewGroup.<init>(ViewGroup.java:573)
            at android.widget.LinearLayout.<init>(LinearLayout.java:203)
            at android.widget.LinearLayout.<init>(LinearLayout.java:199)
            at android.widget.LinearLayout.<init>(LinearLayout.java:195)
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at android.view.LayoutInflater.createView(LayoutInflater.java:619)
            at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.example.savag.myapplication.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Einer der Fehler, die ich glaube, ich weiß, und das ist mit Erinnerung zu tun, um ehrlich zu sein ich habe nicht alle, dass viel auf dem Bildschirm, (meiner Meinung sowieso), vermute ich, muss ich tun, irgendeine Art von aysnc zu überwinden? Die anderen Fliegen an mir vorbei, ohne dass ein Idee.

Eine Aufklärung wäre sehr hilfreich bitte.

XML-layout-Hinzugefügt zur Klärung:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:background="@drawable/tugsedit"
    android:orientation="vertical"
    android:gravity="bottom">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="25dp"
            android:id="@+id/imageView"
            android:layout_gravity="center_vertical"
            android:background="@drawable/topbarmaincenter"
            android:layout_marginTop="30dp" />

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton4" />
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="245dp"
        android:background="@drawable/logoandbar4"
        android:layout_gravity="bottom"
        android:layout_marginBottom="6dp"
        android:weightSum="1">

        <ImageButton
            android:layout_width="59dp"
            android:layout_height="63dp"
            android:id="@+id/imageButton"
            android:layout_gravity="bottom"
            android:background="@drawable/motionbuttonup"
            android:layout_marginLeft="205dp"
            android:layout_marginBottom="1dp" />

        <ImageButton
            android:layout_width="59dp"
            android:layout_height="63dp"
            android:id="@+id/imageButton2"
            android:layout_gravity="bottom"
            android:background="@drawable/positionbuttonup"
            android:layout_marginBottom="1dp"
            android:layout_marginLeft="1dp"
            android:clickable="false" />

        <ImageButton
            android:layout_width="59dp"
            android:layout_height="63dp"
            android:id="@+id/imageButton3"
            android:layout_gravity="bottom"
            android:background="@drawable/envirobuttonup"
            android:layout_marginBottom="1dp"
            android:layout_marginLeft="1dp" />

    </LinearLayout>

</LinearLayout>

Und für die .Java:

package com.example.savag.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        //Handle action bar item clicks here. The action bar will
        //automatically handle clicks on the Home/Up button, so long
        //as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
  • Bitte zeigen Sie dem layout in Zeile 34(+-10).
  • Nicht erlaubt, weitere Bilder, die ich denke?
  • Ich meine xml layout
  • Verursacht durch: java.lang.OutOfMemoryError: Fehler beim zuordnen einer 70056012 byte-Zuordnung mit 4194304 bytes frei und 46MB bis OOM
  • Ja, ich habe das Teil, nicht sicher, wie Sie zu beheben, dass entweder. Aber es alllll die anderen Sachen, das ist ein problem
InformationsquelleAutor Savagefool | 2015-09-26

3 Kommentare

  1. 2

    Scheint es, als ob etwas falsch sein kann mit Ihnen layout-Gasgeneratoren.

    • Danke für die schnelle Antwort. Erweitern Sie bitte.
    • Ich glaube, dass Ihre XML-Datei nicht geladen werden kann. Sie können sehen, dass, weil er sagt der Fehler ist in Zeile 13 der MainActivity, und Zeile 13 ist, was startet die set-Inhalt ansehen Datei. Versuchen Sie, android:tools, um Ihre lineare Anordnung, und stellen Sie die Werkzeuge, um Ihre Haupttätigkeit Datei. Ich bin nicht positiv, dass es funktionieren wird, aber versuchen Sie es und lassen Sie mich wissen.
  2. 2

    Müssen Sie zeigen Sie Ihre xml-Dateien zu 100% erhalten-Lösung. Dies ist den meisten mal passiert, wenn Sie die Belastung ZU groß, Bild auf Ihrem Bildschirm. Versuchen Sie nicht, Daten zu laden, und wahrscheinlich dieses problem verschwinden.

    • Danke für die Klarstellung. XML Hinzugefügt.
    • Ja, dein xml scheint nicht laggt. Versuchen Sie, Farben zu nutzen, als Ihre background und Bilder src und das problem könnte verschwinden. Die Bilder könnten zu groß sein.
    • Zu groß, meinst du die Größe in bytes oder in der körperlichen Größe?
    • Beide können problen
    • Zweitens, dass, starten Sie, indem Sie src – / hintergrund-drawables aus Ihrem layout-Komponenten
    • Ich wirklich brauche Sie, obwohl, kann es doch nicht sein, dass ich nicht haben kann Hintergrundbild drawables heh

  3. 1

    Ich glaube, Ihre android app Hintergrundbild ist zu groß. Bitte gehen Sie auf die AndroidManifest.xml und fügen Sie die folgende Zeile code in Ihre AndroidManifest.xml Datei:

    android:largeHeap="true"

Kostenlose Online-Tests