私はこれらの種類の質問がここで何回も尋ねられ、提供された解決策のどれも助けられなかったことを知っています。Android Java:BoofCV統合の問題
私は最近のGradleを使用して、私のAndroid StudioプロジェクトにBoofCVを追加しようとしました:
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 App」 - ビルドに失敗しました。プロジェクトで多くの変更があったため、別の質問からエラーが発生しました。
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
私は、これらのエラー のトンを取得し、私はProGuardののコンフィグにおけるインナークラス属性を無視する習慣はありません。 これらのエラーのため、ビルドに数時間かかる。
Boof-CV-Siteからすべての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.
ページの上部に表示されているとおり、私は既に実装しています。しかし、既にAndroid.Application Pluginを使用しているので、Javaプラグインを使用することはできません。新しいAndroid Studio 2.2.3ではサポートされていないため、Java 7への切り替えは機能しません。
は、今私は、ソースコードをダウンロードし、ファイル - >新規作成 - >新規モジュール - > [インポートのGradleを使用し、ソースbuild.gradle
に移動し、それらを埋め込まれました。 「Javaの」コマンドので、コンパイル機能を使用することができません。しかし、それはすべてが
アイデアコマンド を知らないと、そのすべてが
プラグインを適用含まれていませんので、多くのビルドgradlesが含まれています。だから私は手でbuild.gradle(多くのbuild.gradleの)を編集する必要があります。 BoofcvをAndroid Studio 2.2.3以上にインストールする方法を教えてください。
に最初のサブセクションをご覧くださいありがとうございました!あなたはそれを実装しようとする日を節約しました。私は本当にどこにエラーがあったのかわからないが、wikiページで指定されたライブラリを除外して、必要なライブラリをインポートするだけで、エラーはもう出ない。ありがとうございました! – fameman
Android Studio/Gradleで生成されるエラーメッセージは恐ろしいものでしたうれしいことは今働いている! –