2016-12-14 200 views
0

我想使用opencsv库jar文件,但在导入时我收到错误消息说“无法从文件* .jar加载插件描述符”。在Android工作室2.2.1 java.bean。*找不到

我检查了jar里面的META-INF/plugin.xml文件,但没有。

所以,我现在导入opencsv的源代码。我在库源代码中使用的java 7 api出现错误。 'java.bean。*'包的所有用法都给出'找不到符号'的错误。

以下是build.gradle文件内容:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.amadeus.jbisht.mytestproject" 
     minSdkVersion 23 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.+' 
    testCompile 'junit:junit:4.12' 
} 

请让我知道我错过了。我可以看到它列在'外部图书馆'下,但android studio没有选择它。

回答

0

摇篮依赖是要走的路:

compile group: 'com.opencsv', name: 'opencsv', version: '3.8+' 

例如,

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.0' 
    compile group: 'com.opencsv', name: 'opencsv', version: '3.8+' 
} 

摇篮会自动导入所需的文件和集成库。

0

opencsv需要一些java.bean库,但它们不包含在Android SDK中。

要解决此问题:在你的Android Studio项目opencsv的

  • 下载源
  • 下载openbean
  • 包括
  • 通过localpath.bean.*在opencsv源替代java.bean.*依赖关系