2016-04-11 23 views
0

Bu yüzden bazı Excel verilerini okumak istediğim Excel dosyasını aldım ve istediğimi yapan Apache POI API'sini buldum. Yine de hafif bir hickup var. Benim Gradle Sync iyi görünüyor ama uygulamayı çalıştırmayı zaman, ben bu hata iletileri alıyorum: Ben bağımlılıkları eklemek için 2 yöntem denediXLSX dosyalarını okumak için poi API'yi kullanmıyor

Note: Some input files use or override a deprecated API. 
 
Note: Recompile with -Xlint:deprecation for details. 
 

 
    AGPBI: {"kind":"error","text":"trouble processing \"javax/xml/XMLConstants.class\":","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"Ill-advised or mistaken usage of a core class (java.* or javax.*)","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"when not building a core library.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"This is often due to inadvertently including a core library file","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"in your application\u0027s project, when using an IDE (such as","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"Eclipse). If you are sure you\u0027re not intentionally defining a","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"core class, then this is the most likely explanation of what\u0027s","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"going on.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"However, you might actually be trying to define a class in a core","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"namespace, the source of which you may have taken, for example,","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"from a non-Android virtual machine project. This will most","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"assuredly not work. At a minimum, it jeopardizes the","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"compatibility of your app with future versions of the platform.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"It is also often of questionable legality.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"If you really intend to build a core library -- which is only","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"appropriate as part of creating a full virtual machine","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"distribution, as opposed to compiling an application -- then use","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"the \"--core-library\" option to suppress this error message.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"If you go ahead and use \"--core-library\" but are in fact","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"building an application, then be forewarned that your application","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"will still fail to build or run, at some point. Please be","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"prepared for angry customers who find, for example, that your","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"application ceases to function once they upgrade their operating","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"system. You will be to blame for this problem.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"If you are legitimately using some code that happens to be in a","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"core package, then the easiest safe alternative you have is to","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"repackage that code. That is, move the classes in question into","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"your own package namespace. This means that they will never be in","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"conflict with core system classes. JarJar is a tool that may help","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"you in this endeavor. If you find that you cannot do this, then","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"that is an indication that the path you are on will ultimately","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"lead to pain, suffering, grief, and lamentation.","sources":[{}]} 
 
AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]} 
 

 
FAILED 
 

 
FAILURE: Build failed with an exception. 
 

 
* What went wrong: 
 
Execution failed for task ':app:transformClassesWithDexForDebug'. 
 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: 
 

 
Error:trouble processing "javax/xml/XMLConstants.class": 
 
Error:Ill-advised or mistaken usage of a core class (java.* or javax.*) 
 
Error:when not building a core library. 
 
Error:This is often due to inadvertently including a core library file 
 
Error:in your application's project, when using an IDE (such as 
 
Error:Eclipse). If you are sure you're not intentionally defining a 
 
Error:core class, then this is the most likely explanation of what's 
 
Error:going on. 
 
Error:However, you might actually be trying to define a class in a core 
 
Error:namespace, the source of which you may have taken, for example, 
 
Error:from a non-Android virtual machine project. This will most 
 
Error:assuredly not work. At a minimum, it jeopardizes the 
 
Error:compatibility of your app with future versions of the platform. 
 
Error:It is also often of questionable legality. 
 
Error:If you really intend to build a core library -- which is only 
 
Error:appropriate as part of creating a full virtual machine 
 
Error:distribution, as opposed to compiling an application -- then use 
 
Error:the "--core-library" option to suppress this error message. 
 
Error:If you go ahead and use "--core-library" but are in fact 
 
Error:building an application, then be forewarned that your application 
 
Error:will still fail to build or run, at some point. Please be 
 
Error:prepared for angry customers who find, for example, that your 
 
Error:application ceases to function once they upgrade their operating 
 
Error:system. You will be to blame for this problem. 
 
Error:If you are legitimately using some code that happens to be in a 
 
Error:core package, then the easiest safe alternative you have is to 
 
Error:repackage that code. That is, move the classes in question into 
 
Error:your own package namespace. This means that they will never be in 
 
Error:conflict with core system classes. JarJar is a tool that may help 
 
Error:you in this endeavor. If you find that you cannot do this, then 
 
Error:that is an indication that the path you are on will ultimately 
 
Error:lead to pain, suffering, grief, and lamentation. 
 
Error:1 error; aborting 
 
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 1

. İlk olarak, tüm kavanoz dosyalarını kendi web sitelerinden indirdim. Bir libs klasörüne koyun ve gradle dosyasına bir dosya ağacı bağımlılığı ekledi. Bu işe yaramadı. Şimdi sadece bu yerine kullanıyorum: Ben çok araştırdım ama buldum yöntemlerin hiçbiri benim için çalışmış

private void XLSFileReader(){ 
        try { 
         FileInputStream file = new FileInputStream(new File(xlsFilePath)); 

         //Create Workbook instance holding reference to .xlsx file 
         XSSFWorkbook workbook = new XSSFWorkbook(file); 

         //Get first/desired sheet from the workbook 
         XSSFSheet sheet = workbook.getSheetAt(0); 

         //Iterate through each rows one by one 
         Iterator<Row> rowIterator = sheet.iterator(); 
         while (rowIterator.hasNext()) 
         { 
          Row row = rowIterator.next(); 

          //For each row, iterate through all the columns 
          Iterator<Cell> cellIterator = row.cellIterator(); 

          while (cellIterator.hasNext()) 
          { 
           Cell cell = cellIterator.next(); 
           //Check the cell type and format accordingly 
           switch (cell.getCellType()) 
           { 
        //Logs to the window to confirm that it works 
        case Cell.CELL_TYPE_NUMERIC: 
         Log.d("Kolumn", cell.getNumericCellValue() + "\t"); 
         break; 
        case Cell.CELL_TYPE_STRING: 
         Log.d("Rad",cell.getStringCellValue() + "\t"); 
         break; 
       } 
      } 
      System.out.println(""); 
     } 
     file.close(); 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 

: // Bu gerçek kod

compile 'org.apache.poi:poi:3.14' 
compile 'org.apache.poi:poi-ooxml:3.14' 
compile 'org.apache.poi:poi-ooxml-schemas:3.14' 
compile 'org.apache.xmlbeans:xmlbeans:2.6.0' 
compile 'com.github.virtuald:curvesapi:1.03' 

.

cevap

İlgili konular