我知道这样的问题在这里被问了很多次,而提供的解决方案都没有帮助。
最近我尝试使用Gradle将BoofCV添加到我的Android项目中:
apply plugin: 'com.android.application'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.as.recognize2"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.1.1'
compile group: "org.boofcv", name: "all", version: "0.26"
compile group: "org.boofcv", name: "android", version: "0.26"
testCompile 'junit:junit:4.12'
}这就是我的build.gradle (应用程序)的样子。
Gradle Sync成功了,但是"Run“构建失败了,我从另一个问题中选择了这样的错误,因为我在我的项目中做了很大的改变,将它改回来是非常困难的。
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.apache.log4j.chainsaw.ControlPanel$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class我得到了大量的这些错误,,并且我不习惯于忽略Pro卫士信任中的内部类属性,因为这些错误,构建需要花费几个小时。
然后,我从Boof-CV-站点下载了所有Jar -文件,并将它们嵌入到libs文件夹中,并对使用maven下载boofcv的编译命令进行了注释。结果:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.正如您在页面顶部看到的,我已经实现了它。但是我不能使用java插件,因为我已经在使用Android.Application插件了。切换回Java 7将无法工作,因为新的AndroidStudio2.2.3不支持它。
现在,我下载了源代码,并通过使用File->New->New >Import并导航到源build.gradle嵌入它们。但是它包含了很多构建级别,它们都不知道idea命令,并且都不包含apply:"java“命令,因此无法使用编译函数。所以我必须手工编辑每一个build.gradle (很多build.gradle)。
我如何清楚地在AndroidStudio2.2.3或更高版本中安装Boofcv?
发布于 2017-01-13 02:02:23
我不知道出了什么问题,但我上周验证了一个示例:源代码 --这是来自最新快照代码的,但它被配置为使用以前的稳定版本。
编辑:查看这个wiki页面上的第一个小节
https://stackoverflow.com/questions/41618283
复制相似问题