2016-03-20 27 views
0

Geçmişte uygulamanız doğru bir şekilde çalışıyordu, ancak şimdi uygulama bana bir hata veriyor ve açmaya çalıştığımda yanıt vermiyor. Kodda burada yapmaya çalıştığım şey Parse.com'dan nesne almaktır. Şu anda uygulamamda üç sekme var ve bu ikinci sekmenin kodu. İşte kod: UPDATE: Uygulamayı çalıştırmayı başardım. Sorun, bir Parsefile'nin yanlış değerini atamaktı. bazı dosyaların derlenmiş sakın gibiAsyncTask nasıl düzeltilir?

03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: Process: ope.playingwithtabs, PID: 7054 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground() 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$3.done(AsyncTask.java:309) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.FutureTask.run(FutureTask.java:242) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.Thread.run(Thread.java:818) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lbolts/Task; 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.checkIfRunning(ParseQuery.java:952) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.doWithRunningCheck(ParseQuery.java:1129) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.findAsync(ParseQuery.java:1193) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.findInBackground(ParseQuery.java:1161) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.find(ParseQuery.java:981) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at ope.playingwithtabs.TwoFragment$RemoteDataTask.doInBackground(TwoFragment.java:79) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at ope.playingwithtabs.TwoFragment$RemoteDataTask.doInBackground(TwoFragment.java:53) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$2.call(AsyncTask.java:295) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.Thread.run(Thread.java:818)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "bolts.Task" on path: DexPathList[[zip file "/data/app/ope.playingwithtabs-2/base.apk"],nativeLibraryDirectories=[/data/app/ope.playingwithtabs-2/lib/x86, /vendor/lib, /system/lib]] 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.checkIfRunning(ParseQuery.java:952)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.doWithRunningCheck(ParseQuery.java:1129)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.findAsync(ParseQuery.java:1193)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.findInBackground(ParseQuery.java:1161)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at com.parse.ParseQuery.find(ParseQuery.java:981)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at ope.playingwithtabs.TwoFragment$RemoteDataTask.doInBackground(TwoFragment.java:79)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at ope.playingwithtabs.TwoFragment$RemoteDataTask.doInBackground(TwoFragment.java:53)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$2.call(AsyncTask.java:295)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.Thread.run(Thread.java:818)  
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: Suppressed: java.lang.ClassNotFoundException: bolts.Task 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.Class.classForName(Native Method) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:  at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime:   ... 14 more 
03-20 17:09:12.478 7054-7079/ope.playingwithtabs E/AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available 
03-20 17:09:13.101 7054-7078/ope.playingwithtabs E/Surface: getSlotFromBufferLocked: unknown buffer: 0xabee5fe0 
03-20 17:09:13.118 7054-7078/ope.playingwithtabs E/Surface: getSlotFromBufferLocked: unknown buffer: 0xabee67c0 
+0

Her ikisi de 'compile' com.parse.bolts eklediniz mi: cıvata-android: 1. + ''ve ' derlemek' com.parse: ayrıştır-android: 1. + ''? – GVillani82

+0

Evet. Şimdi şu iki tane ekledim ve şimdi başka bir hata alıyorum. Hata: Yürütme ': app: dexDebug' görevi için başarısız oldu. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: 'komut' işlemini 'C: \ Program Files \ Java \ jdk1.8.0_25 \ bin \ java.exe' 'ile bitti sıfır olmayan çıkış değeri 2 – user3479469

+0

Tamam. Birkaç şey değişti ve şimdi çalışıyor. – user3479469

cevap

0

görünüyor: Burada

public class TwoFragment extends Fragment{ 

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


GridView gridview; 
List<ParseObject> ob; 
ProgressDialog mProgressDialog; 
GridViewAdapter adapter; 
private List<GameList> gamearraylist = null; 


@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 


    new RemoteDataTask().execute(); 

} 

// RemoteDataTask AsyncTask 
private class RemoteDataTask extends AsyncTask<Void, Void, Void> { 
    @Override 
    protected void onPreExecute() { 
     super.onPreExecute(); 
     // Create a progressdialog 
     mProgressDialog = new ProgressDialog(getContext()); 
     // Set progressdialog title 
     mProgressDialog.setTitle("Place Holder Title"); 
     // Set progressdialog message 
     mProgressDialog.setMessage("Loading..."); 
     mProgressDialog.setIndeterminate(false); 
     // Show progressdialog 
     mProgressDialog.show(); 
    } 

    @Override 
    protected Void doInBackground(Void... params) { 
     // Create the array 
     gamearraylist = new ArrayList<GameList>(); 
     try { 
      // Locate the class table named "SamsungPhones" in Parse.com 
      ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
        "GamesList"); 
      // Locate the column named "position" in Parse.com and order list 
      // by ascending 
      query.orderByAscending("position"); 
      ob = query.find(); 
      for (ParseObject country : ob) { 
       ParseFile image = (ParseFile) country.get("games"); 
       GameList map = new GameList(); 
       map.setGame(image.getUrl()); 
       gamearraylist.add(map); 
      } 
     } catch (ParseException e) { 
      Log.e("Error", e.getMessage()); 
      e.printStackTrace(); 
     } 
     return null; 
    } 

    @Override 
    protected void onPostExecute(Void result) { 
     // Locate the gridview in gridview_main.xml 
     gridview = (GridView) getView().findViewById(R.id.gridView); 

     // Pass the results into ListViewAdapter.java 
     adapter = new GridViewAdapter(getContext(), 
       gamearraylist); 
     // Binds the Adapter to the ListView 
     gridview.setAdapter(adapter); 
     // Close the progressdialog 
     mProgressDialog.dismiss(); 
    } 
} 


@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container, 
         Bundle savedInstanceState) { 

    View view = inflater.inflate(R.layout.fragment_two,container,false); 
    GridView gridView = (GridView) view.findViewById(R.id.gridView); 


    gridView.setAdapter(new ImageAdapter1(view.getContext())); 

    return view; 

} } 

Ve

Ben kodu çalıştırmak her görünmesini devam ediyor logcat hatadır. En son bu sorunla karşılaştığımda, app/build klasörünü sildim ve Gradle projeyi yeniden oluşturmasına izin verdim. Bu benim için çalıştı.