项目从eclipse运行但是当导出到gradle异步抛出错误时

时间:2015-03-05 12:02:44

标签: android eclipse android-studio google-glass google-gdk

我正试图让BarcodeEye在我自己的项目中工作。 当我在eclipse中导入项目并尝试运行它时,它工作得很好。

然后我尝试了以下3种方式在android studio中获取它。

  1. 首先,我将现有项目所需的所有文件复制到我自己的项目中。在设置了所有te正确的导入和包名后,当我尝试构建它时会出现4个错误(将在下面发布错误)
  2. 我直接在android工作室打开了eclipse项目并试图构建它。我有4个错误(见下文)
  3. 我将eclipse项目导出到gradle,然后在android studio中打开它。我又犯了4个错误。
  4. 有没有人知道这里出了什么问题?

    错误

        C:\Users\xx\xx\BarcodeEye\src\com\google\zxing\client\android\camera\AutoFocusManager.java:59: error: method executeOnExecutor in class AsyncTask<Params,Progress,Result> cannot be applied to given types;
          outstandingTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                         ^
      required: Executor,CAP#1[]
      found: Executor
      reason: formal varargs element type CAP#1 is not accessible from class AutoFocusManager
      where Params,Progress,Result are type-variables:
        Params extends Object declared in class AsyncTask
        Progress extends Object declared in class AsyncTask
        Result extends Object declared in class AsyncTask
      where CAP#1 is a fresh type-variable:
        CAP#1 extends Object from capture of ?
    C:\Users\xx\xx\BarcodeEye\src\com\github\barcodeeye\migrated\InactivityTimer.java:50: error: method executeOnExecutor in class AsyncTask<Params,Progress,Result> cannot be applied to given types;
            inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                          ^
      required: Executor,CAP#1[]
      found: Executor
      reason: formal varargs element type CAP#1 is not accessible from class InactivityTimer
      where Params,Progress,Result are type-variables:
        Params extends Object declared in class AsyncTask
        Progress extends Object declared in class AsyncTask
        Result extends Object declared in class AsyncTask
      where CAP#1 is a fresh type-variable:
        CAP#1 extends Object from capture of ?
    C:\Users\xx\xx\BarcodeEye\src\com\google\zxing\client\android\share\AppPickerActivity.java:35: error: method executeOnExecutor in class AsyncTask<Params,Progress,Result> cannot be applied to given types;
        backgroundTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                      ^
      required: Executor,CAP#1[]
      found: Executor
      reason: formal varargs element type CAP#1 is not accessible from class AppPickerActivity
      where Params,Progress,Result are type-variables:
        Params extends Object declared in class AsyncTask
        Progress extends Object declared in class AsyncTask
        Result extends Object declared in class AsyncTask
      where CAP#1 is a fresh type-variable:
        CAP#1 extends Object from capture of ?
    Note: C:\Users\xx\xx\BarcodeEye\src\com\github\barcodeeye\scan\api\CardPresenter.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    3 errors
    
     FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':compileDebugJava'.
    

1 个答案:

答案 0 :(得分:2)

好好仔细看看AsyncTasks他们自己后,我发现了错误的来源。

显然,在将项目转换为android studio时,它并没有采用asyncTask

的值

看起来像这样

AsyncTask<?, ?, ?> someTask;

然后我接着改变了所有的AsyncTask来保存适当的功能。

因此,如果其他人遇到此问题,请检查您的AsyncTask标识符,这是导致问题的原因