Author

Topic: Building bitcoinj for Android (Read 5707 times)

newbie
Activity: 6
Merit: 0
May 06, 2016, 05:09:31 PM
#7
Hi there, I know this is super old, but I didn't search for help when I used bitcoinj on android an had several problems using Android Studio.
The error was: " Failure [INSTALL_FAILED_NO_MATCHING_ABIS] "

It depends on the Android device used (or emulated) but the problem is with the Scrypt library.

I was able to fix it by adding this exclussion at the build.gradle file of the Android project.

        exclude 'lib/x86_64/darwin/libscrypt.dylib'
        exclude 'lib/x86_64/freebsd/libscrypt.so'
        exclude 'lib/x86_64/linux/libscrypt.so'
        exclude 'org/bitcoinj/crypto/cacerts'


Then adding bitcoinj to Java modules in Android Studio works just fine.
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.bitcoinj:bitcoinj-core:0.13.3'
    testCompile 'junit:junit:4.12'
}

Hopes it helps someone!
sr. member
Activity: 376
Merit: 250
May 15, 2014, 01:11:41 PM
#6
any updates on your way with Android Studio??
newbie
Activity: 22
Merit: 4
January 27, 2014, 04:56:08 PM
#5
I'll give it a shot with Android Studio. If I manage to get it working I'll make a little how-to doc as well. Thanks!
legendary
Activity: 1526
Merit: 1134
January 27, 2014, 03:36:50 PM
#4
These days you really need to be using a proper build system that understands dependency resolution. BitcoinJ is a large codebase these days, and it depends on other libraries to work.

Try Android Studio. It's the future Android IDE and it uses Gradle, which knows how to depend on Maven targets (there are docs on how to use Maven on the bitcoinj website). Then it will go download protobufs, guava, all the other stuff bitcoinj needs.
newbie
Activity: 22
Merit: 4
January 27, 2014, 11:37:31 AM
#3
No my app is not using Maven. I'm just building it using Eclipse IDE. You'd think it would be fine because I'm not having any issues with any of my other libraries that I'm importing.

legendary
Activity: 1526
Merit: 1134
January 27, 2014, 11:27:58 AM
#2
Is your Android app using Maven/Gradle as well? It sounds like the library can't find its dependencies, which can happen if you aren't using something like Maven/Gradle for your own build.
newbie
Activity: 22
Merit: 4
January 27, 2014, 11:03:48 AM
#1
Hey all,

I'm trying to build bitcoinj for use with an Android App using Maven.

For starters, I have built the latest version (commit 4ca476ff353913b33034ff5e5a1f0c4d734d8c64)

I have a generated bitcoinj-0.11-SNAPSHOT.jar file and am importing it into my Android App Lib.

When I try to use the library, I am getting a "java.lang.NoClassDefFoundError: org.bitcoinj.wallet.Protos$Wallet" error. There is a similar discussion here: http://code.google.com/p/bitcoinj/issues/detail?id=133 but I did not understand the solution and am not sure if it would work for me.

When I look inside the generated JAR, the class is in there but am still getting the NoClassDefFoundError. Any help is appreciated.

Thanks!

Jump to: