未显示Android Studio Logcat中的调试消息

时间:2018-08-06 20:54:11

标签: android android-studio logcat

我使用Log.e方法编写了以下代码,以尝试区分我的日志消息与其他所有消息。将它们放置在各处,以开始登录,每分钟登录和在屏幕上点击。问题是在计时器启动时仅发送第一条日志消息。在该消息之后,将显示此错误:

E/GED: Failed to get GED Log Buf, err(0)

我相信这是罪魁祸首,但是我不确定如何解决此问题...

这是我的日志:

8-06 13:51:37.484 6962-6962/? I/art: Late-enabling -Xcheck:jni
08-06 13:51:37.647 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:37.868 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:37.929 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:37.989 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.055 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.116 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.176 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.236 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.297 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.367 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.448 6962-6962/com.kk6axq.literatureclock W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.kk6axq.literatureclock-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.kk6axq.literatureclock-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
08-06 13:51:38.451 6962-6962/com.kk6axq.literatureclock W/System: ClassLoader referenced unknown path: /data/app/com.kk6axq.literatureclock-1/lib/arm
08-06 13:51:38.455 6962-6962/com.kk6axq.literatureclock I/InstantRun: starting instant run server: is main process
08-06 13:51:38.575 6962-6962/com.kk6axq.literatureclock W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
08-06 13:51:38.669 6962-6962/com.kk6axq.literatureclock I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
08-06 13:51:38.670 6962-6962/com.kk6axq.literatureclock I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
08-06 13:51:38.825 6962-6962/com.kk6axq.literatureclock E/com.kk6axq.literatureclock.ClockActivity: Timer started
08-06 13:51:38.859 6962-7018/com.kk6axq.literatureclock I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
08-06 13:51:38.859 6962-7018/com.kk6axq.literatureclock D/libc-netbsd: [getaddrinfo]: mtk netid=0; mark=0
08-06 13:51:38.860 6962-7018/com.kk6axq.literatureclock D/libc-netbsd: getaddrinfo( app_uid:10226
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10226
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
    [getaddrinfo]: mtk netid=0; mark=0
    getaddrinfo( app_uid:10226
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10226
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
08-06 13:51:38.881 6962-6962/com.kk6axq.literatureclock I/[MALI][Gralloc]: [+]r_hnd(0xb7ff7330), client(46), share_fd(45)
08-06 13:51:38.929 6962-7018/com.kk6axq.literatureclock D/libc-netbsd: getaddrinfo: get result from proxy gai_error = 0
08-06 13:51:38.930 6962-7018/com.kk6axq.literatureclock I/System.out: [CDS]rx timeout:0
08-06 13:51:38.980 6962-7022/com.kk6axq.literatureclock E/GED: Failed to get GED Log Buf, err(0)
08-06 13:51:38.980 6962-7022/com.kk6axq.literatureclock I/OpenGLRenderer: Initialized EGL, version 1.4
08-06 13:51:38.987 6962-7022/com.kk6axq.literatureclock I/OpenGLRenderer: Get enable program binary service property (1)
    Initializing program atlas...
08-06 13:51:38.988 6962-7022/com.kk6axq.literatureclock I/OpenGLRenderer: Program binary detail: Binary length is 143664, program map length is 128.
    Succeeded to mmap program binaries. File descriptor is 52, and path is /dev/ashmem.
    No need to use file discriptor anymore, close fd(52).
08-06 13:51:38.997 6962-6973/com.kk6axq.literatureclock W/art: Suspending all threads took: 7.498ms
08-06 13:51:38.998 6962-7022/com.kk6axq.literatureclock W/libEGL: [ANDROID_RECORDABLE] format: 1
08-06 13:51:39.024 6962-6973/com.kk6axq.literatureclock I/art: Background sticky concurrent mark sweep GC freed 57245(3MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 8MB/10MB, paused 10.030ms total 77.364ms
08-06 13:51:39.025 6962-6971/com.kk6axq.literatureclock I/System: FinalizerDaemon: finalize objects = 1
08-06 13:51:39.029 6962-7018/com.kk6axq.literatureclock D/libc-netbsd: [getaddrinfo]: mtk netid=0; mark=0
    getaddrinfo( app_uid:10226
08-06 13:51:39.030 6962-7018/com.kk6axq.literatureclock D/libc-netbsd: getaddrinfo() uid prop:
    getaddrinfo() getuid():10226
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
08-06 13:51:39.054 6962-6962/com.kk6axq.literatureclock W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
08-06 13:51:39.068 6962-7018/com.kk6axq.literatureclock E/NativeCrypto: ssl=0xb8df3a38 cert_verify_callback x509_store_ctx=0xa305cf9c arg=0x0
    ssl=0xb8df3a38 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
08-06 13:51:39.068 6962-7022/com.kk6axq.literatureclock I/PerfService: PerfServiceNative api init
08-06 13:51:39.077 6962-7022/com.kk6axq.literatureclock I/[MALI][Gralloc]: [+]r_hnd(0xb900e0a0), client(46), share_fd(57)
08-06 13:51:39.091 6962-6962/com.kk6axq.literatureclock I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@5fcd0a0 time:8366569
08-06 13:51:39.211 6962-7018/com.kk6axq.literatureclock I/System.out: gba_cipher_suite:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
08-06 13:51:39.213 6962-7018/com.kk6axq.literatureclock I/System.out: [CDS]rx timeout:0
08-06 13:51:39.215 6962-7018/com.kk6axq.literatureclock I/System.out: [CDS]rx timeout:0
    [OkHttp] sendRequest>>
    [OkHttp] sendRequest<<

这是我的代码:

package com.kk6axq.literatureclock;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.PrecomputedText;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * TODO: Add handling for multiple versions of pictures, ie more than img_0.png.
 */
public class ClockActivity extends AppCompatActivity {
    private final String IMAGE_LISTING_URL = "https://raw.githubusercontent.com/kk6axq/literature_clock_imgs/master/images/files.txt";
    private final String IMAGE_URL_BEGINNING = "https://raw.githubusercontent.com/kk6axq/literature_clock_imgs/master/images/";

    private final String METADATA_URL_BEGINNING = "https://raw.githubusercontent.com/kk6axq/literature_clock_imgs/master/images/metadata/quote_";

    private final String IMAGE_BEGINNING = "quote_";
    private final String IMAGE_ENDING = "_0.png";

    private ImageView imgView;
    private final boolean IMAGE = true;
    private final boolean METADATA = false;
    private boolean currentType = IMAGE;
    private ArrayList<String> imageList;

    private static final String TAG = ClockActivity.class.getName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clock);
        imgView = findViewById(R.id.imageView);
        new fetchListing().execute();
        imgView.setOnClickListener(new View.OnClickListener() {
            //@Override
            public void onClick(View v) {
                currentType = !currentType;
                Log.e(TAG, "Type changed");
                typeChanged();
            }
        });
        //From https://stackoverflow.com/questions/13626126/calling-a-method-every-10-minutes-in-android
        Timer timer = new Timer();
        TimerTask minuteTask = new TimerTask() {
            @Override
            public void run() {
                updateScreen();
                Log.e(TAG, "Screen Updated");
            }
        };

        // schedule the task to run starting now and then every minute
        timer.schedule(minuteTask, 0l, 1000 * 60);
        Log.e(TAG, "Timer started");
    }

    private class fetchListing extends AsyncTask {


        @Override
        protected Object doInBackground(Object[] objects) {
            fetchImageListing();
            return null;
        }
    }

    private void fetchImageListing() {
        //From https://stackoverflow.com/questions/38372571/android-how-can-i-read-a-text-file-from-a-url
        //Initialize Array
        imageList = new ArrayList<String>();

        try {
            // Create a URL for the desired page
            URL url = new URL(IMAGE_LISTING_URL);
            // Read all the text returned by the server
            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));


            String str;
            //Read all strings into array.
            while ((str = in.readLine()) != null) {
                imageList.add(str);
            }
            //Close buffer
            in.close();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Called when type of image changed. Either from image to metadata or from metadata to image.
     */
    public void typeChanged() {
        updateScreen();
    }

    private boolean isImageInList(String image) {
        return imageList.contains(image);
    }

    //From https://stackoverflow.com/questions/1378199/how-to-check-if-a-url-exists-or-returns-404-with-java
    public static int getResponseCode(String urlString) throws MalformedURLException, IOException {
        URL u = new URL(urlString);
        HttpURLConnection huc = (HttpURLConnection) u.openConnection();
        huc.setRequestMethod("GET");
        huc.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)");
        huc.connect();
        return huc.getResponseCode();
    }

    /**
     * Finds the url for the closest valid image in the repository.
     *
     * @param time 4 character string for time, in format hhmm
     * @param type image or metadata
     * @return valid url
     */
    private String getClosestImageURL(String time, boolean type) throws IllegalStateException {
        String out = "";
        String tempUrl = "";
        String image = IMAGE_BEGINNING + time + IMAGE_ENDING;
        boolean imageInList = isImageInList(image);
        while (!imageInList) {
            int t = Integer.parseInt(time);
            t--;
            time = Integer.toString(t);
            image = IMAGE_BEGINNING + time + IMAGE_ENDING;
            imageInList = isImageInList(image);
        }
        if (type == IMAGE) {
            tempUrl = IMAGE_URL_BEGINNING + image;
        } else {
            //Type is METADATA
            tempUrl = METADATA_URL_BEGINNING + image;

        }
        int code = 0;
        try {
            code = getResponseCode(tempUrl);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (code != 200) {
            throw (new IllegalStateException("Supposedly valid image returned non 200 http code: " + Integer.toString(code)));
        } else {
            out = tempUrl;
        }
        return out;
    }

    /**
     * Fetches image and updates screen.
     */
    public void updateScreen() {
        /* **** Calculate time **** */
        //Get current time
        Date dt = new Date();
        //Format time as hhmm for fetching image
        SimpleDateFormat sdf = new SimpleDateFormat("kkmm");
        //Convert time to string
        String time = sdf.format(dt);
        /* **** Calculate closest image **** */
        String url = "";
        try {
            url = getClosestImageURL(time, currentType);
        } catch (IllegalStateException e) {
            e.printStackTrace();
        }
        /* **** Fetch and set image **** */
        new DownloadImageTask((ImageView) findViewById(R.id.imageView))
                .execute(url);
    }

    //From http://web.archive.org/web/20120802025411/http://developer.aiwgame.com/imageview-show-image-from-url-on-android-4-0.html
    private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
        ImageView bmImage;

        public DownloadImageTask(ImageView bmImage) {
            this.bmImage = bmImage;
        }

        protected Bitmap doInBackground(String... urls) {
            String urldisplay = urls[0];
            Bitmap mIcon11 = null;
            try {
                InputStream in = new java.net.URL(urldisplay).openStream();
                mIcon11 = BitmapFactory.decodeStream(in);
            } catch (Exception e) {

                e.printStackTrace();
            }
            return mIcon11;
        }

        protected void onPostExecute(Bitmap result) {
            bmImage.setImageBitmap(result);
            Log.e(TAG,"Image set");
        }
    }
}

0 个答案:

没有答案