안드로이드 스튜디오에서는 이상없는데 실제 폰으로 하면 다운이됩니다. 도와주세요.

조회수 108회

여기에서 에러가 나는것 같은데요. 도와주세요.

 E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)

이런 에러도 뜹니다.

Tab1Fragments.java


public class Tab1Fragment extends Fragment {

    private static String GOOGLE_YOUTUBE_API_KEY = "----------------------"; //
    private static String CHANNEL_ID="UCyn-----------------"; 
    private static String CHANNLE_GET_URL = "https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&channelId=" + CHANNEL_ID + "&maxResults=20&key=" + GOOGLE_YOUTUBE_API_KEY + "";


    private RecyclerView mList_videos = null;
    private VideoPostAdapter adapter = null;
    private ArrayList<YoutubeDataModel> mListData = new ArrayList<>();

    public Tab1Fragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this
        View view = inflater.inflate(R.layout.fragment_tab1, container, false);
        mList_videos=(RecyclerView) view.findViewById(R.id.mList_videos);
        initList(mListData);
        new RequstYoutubeAPI().execute();
        return view;
    }

    private void initList(ArrayList<YoutubeDataModel> mListData) {
        mList_videos.setLayoutManager(new LinearLayoutManager(getActivity()));
        adapter = new VideoPostAdapter(getActivity(), mListData);

        mList_videos.setAdapter(adapter);
    }

    //creat an AsyncTask to get all tha data form youtube

    private class RequstYoutubeAPI extends AsyncTask<Void, String, String>{

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        @Override
        protected String doInBackground(Void... params) {
            HttpClient httpClient = new DefaultHttpClient();
            HttpGet httpGet = new HttpGet(CHANNLE_GET_URL);
            Log.e("URL", CHANNLE_GET_URL);
            try {
                HttpResponse response = httpClient.execute(httpGet);
                HttpEntity httpEntity = response.getEntity();
                String json = EntityUtils.toString(httpEntity);
                return json;
            } catch (IOException e) {
                e.printStackTrace();
            }

            return null;
        }

        @Override
        protected void onPostExecute(String response) {
            super.onPostExecute(response);
            if (response != null) {
                try {
                    JSONObject jsonObject = new JSONObject(response);
                    Log.e("response", jsonObject.toString());
                    mListData = parseVideoListFromResponse(jsonObject);
                    initList(mListData);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    private ArrayList<YoutubeDataModel> parseVideoListFromResponse(JSONObject jsonObject) {
        ArrayList<YoutubeDataModel> mList = new ArrayList<>();

        if (jsonObject.has("items")) {
            try {
                JSONArray jsonArray = jsonObject.getJSONArray("items");
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject json = jsonArray.getJSONObject(i);
                    if (json.has("id")) {
                        JSONObject jsonID = json.getJSONObject("id");
                        if (jsonID.has("kind")) {
                            if (jsonID.getString("kind").equals("youtube#video")) {
                                //get the data from snippet
                                YoutubeDataModel youtubeObject = new YoutubeDataModel();
                                JSONObject jsonSnippet = json.getJSONObject("snippet");
                                String title = jsonSnippet.getString("title");
                                String description = jsonSnippet.getString("description");
                                String publishedAt = jsonSnippet.getString("publishedAt");
                                String thumbnail = jsonSnippet.getJSONObject("thumbnails").getJSONObject("high").getString("url");

                                youtubeObject.setTitle(title);
                                youtubeObject.setDescription(description);
                                youtubeObject.setPublishedAt(publishedAt);
                                youtubeObject.setThumbnail(thumbnail);
                               // youtubeObject.setVideo_id(video_id);
                                mList.add(youtubeObject);
                            }
                        }
                    }

                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        return  mList;

    }
}
  • 무엇을 하고자 한 것이며 어떻게 하려고 했는데 오류가 났다 라고 명확히 알아야 할듯 합니다. 오류 로그도 없이 코드만 보고 판단 하기는 어려울 듯 하군요 태평장사꾼 2019.9.19 12:34
  • 버전에 따라 문제가 있는듯합니다. 김현수 2019.9.19 18:36
  • 폰들 연결해서 오류로그 확인해보니 뭔가 뜨네요... 고수님들 조금 도움 부탁드립니다. ㅠㅠ 김현수 2019.9.19 18:37
  • E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.app, PID: 19331 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:354) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory; at org.apache.http.impl.client.AbstractHttpClient.(AbstractHttpClient.java:182) at org.apache.http.impl.client.DefaultHttpClient.(DefaultHttpClient.java:150) at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:83) at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:73) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/com.app-33wbdaOQAv_7eyC_An1aAg==/base.apk"],nativeLibraryDirectories=[/data/app/com.app-33wbdaOQAv_7eyC_An1aAg==/lib/arm64, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at org.apache.http.impl.client.AbstractHttpClient.(AbstractHttpClient.java:182) at org.apache.http.impl.client.DefaultHttpClient.(DefaultHttpClient.java:150) at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:83) at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:73) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) 김현수 2019.9.19 18:39

2 답변

  • E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.app, PID: 19331
    java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:354)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
    at java.util.concurrent.FutureTask.run(FutureTask.java:271)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
    Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
    at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:182)
    at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:150)
    at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:83)
    at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:73)
    at android.os.AsyncTask$2.call(AsyncTask.java:333)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at java.lang.Thread.run(Thread.java:764) 
    Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/com.app-33wbdaOQAv_7eyC_An1aAg==/base.apk"],nativeLibraryDirectories=[/data/app/com.app-33wbdaOQAv_7eyC_An1aAg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:182) 
    at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:150) 
    at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:83) 
    at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:73) 
    at android.os.AsyncTask$2.call(AsyncTask.java:333) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at java.lang.Thread.run(Thread.java:764) 
    

    오류로그인데

    com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:83) 
    at com.app.fragments.Tab1Fragment$RequstYoutubeAPI.doInBackground(Tab1Fragment.java:73) 
    

    여기가 문제인것 같습니다 도와주시면 감사하겠습니다.

  • 하다보니 해결했습니다.

    메니페스토에 어플리케이션에 넣으면되네요

    • 혼자 해결하시다니 대단합니다! 김은기 2019.9.20 15:03

답변을 하려면 로그인이 필요합니다.

Hashcode는 개발자들을 위한 무료 QnA 사이트입니다. 계정을 생성하셔야만 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 계정을 생성하셔야만 글을 작성하실 수 있습니다.