我目前正在尝试使用openimaj库中的依赖项构建一个android项目。
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.mapinguari.myapplication"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'org.openimaj:openimaj:1.3.1'
}是我的模块构建文件。它在同步到IDE时没有报告错误。
但是,当我试图在其中一个源文件中构造任何类时,Android不会识别openimaj依赖项中的任何类。
任何帮助都很感激。
谢谢!
发布于 2015-11-02 16:54:11
我认为这可能是因为您指定了一个非jar OpenIMAJ依赖项(具体来说,您已经告诉它链接到OpenIMAJ主pom文件,该文件只包含对不同子模块的引用)。您可能需要实际选择所需的特定模块--例如,如果应用程序正在进行图像处理,则添加依赖项org.openimaj:image-processing:1.3.1。
编辑:,似乎batik库在某个地方有一个循环依赖关系,从而破坏了Gradle (参见https://issues.apache.org/jira/browse/BATIK-1098)。这就是导致最终StackOverflowError的原因。此外,一些东西正在引入xml,这将与Android发生冲突。假设您不介意没有SVG映像支持,那么下面的工作应该是有效的:
repositories {
mavenCentral()
maven {
url "http://maven.openimaj.org"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:18.+'
compile('org.openimaj:image-processing:1.3.1') {
exclude group: 'org.apache.xmlgraphics'
exclude group: 'xml-apis'
}
}您还可能希望为应用程序中不需要的依赖项添加额外的排除--似乎仅仅包含org.openimaj:image-processing就会引出许多几乎肯定不需要的东西(我已经在这里为它创建了一个问题:https://github.com/openimaj/openimaj/issues/97)。
https://stackoverflow.com/questions/33466469
复制相似问题