Android Studio项目运行错误

时间:2017-10-30 08:31:26

标签: android

当我尝试在Android Studio中运行我的项目时。它总是给我这个错误。我试图清理和重建,但它还没有工作......

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
  

com.android.build.api.transform.TransformException:java.lang.RuntimeException:java.lang.RuntimeException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:java.io .FileNotFoundException:Z:\ Android \ CalculatorAutumn7 \ app \ build \ intermediates \ transforms \ dex \ debug \ folders \ 1000 \ 5 \ slice_1 \ classes.dex(系统找不到指定的路径)

1 个答案:

答案 0 :(得分:0)

您必须提供正确的文件路径

从资产中读取文件

  • 使用tyr catch block
  • 给出file_name + extension(如.txt)

      BufferedReader mRreader = null;
        try {
            mRreader = new BufferedReader(
            new InputStreamReader(getAssets().open("your_file_name.txt");
           // do reading,usually loop until end of file reading 

           String mLine; 

            while ((mLine = mRreader.readLine()) != null) { //process line
            /// write code
            }
        } catch (IOException e) {
            //log the exception 
        } finally {
            if (mRreader != null) {
                try {
                    mRreader.close();
                } catch (IOException e) { //log the exception } } }


                }

            }