ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.18k stars 1.1k forks source link

Build error when adding EthereumJ as a dependency #1024

Closed ghost closed 6 years ago

ghost commented 6 years ago

Whenever I add the ethereumJ library to my build.gradle file, gradle is able to resolve all the dependencies. But when I go to build my project I get the error:

More than one file was found with OS independent path 'META-INF/spring.tooling'

dependencies {    
    compile "org.ethereum:ethereumj-core:latest.release"
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/ethereum/maven" }
    }
}
mkalinin commented 6 years ago

could you please tell more about the environment?

ghost commented 6 years ago

I'm not too sure what you mean by that, but here's my entire build.gradle file. I'm also using Android Studio 3.0.1 if that helps.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.cointxinc.cointx"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            java.srcDirs = ['src/main/java', 'src/main/java/com.cointxinc.cointx/Exchanges']
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:design:26.1.0'
    compile 'me.dm7.barcodescanner:zxing:1.8.4'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    compile 'com.pusher:pusher-java-client:1.6.0'
    //compile "org.ethereum:ethereumj-core:latest.release"
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/ethereum/maven" }
    }
}

Also it's worth noting that the problem has to be with the line:

compile "org.ethereum:ethereumj-core:latest.release"

because if I comment that line out, the project successfully builds.

adonley commented 6 years ago

Try specifying the jar version and see if that works:

compile([group: 'org.ethereum', name: 'ethereumj-core', version: '1.6.3-RELEASE']) {
        exclude group: "log4j"
        exclude group: "org.slf4j", module: "log4j-over-slf4j"
        exclude group: "org.slf4j", module: "slf4j-log4j12"
}

@mkalinin what is the reason this project deployed to mavencentral or jcenter?

ghost commented 6 years ago

Hi adonley, I tried that and I still get the same error unfortunately.

zilm13 commented 6 years ago

@cekoivisto have you tried to add this to build.gradle?

packagingOptions {
    exclude 'META-INF/spring.tooling'
}
ghost commented 6 years ago

@zilm13 Thanks, I also had to exclude 3 more files, but it worked.

mkalinin commented 6 years ago

@adonley it's deployed to Bintray only. maybe you meant NOT deployed?