bad apk when using bitcoinj from maven central
Asked Answered
K

2

2

I just tried to switch from a local bitcoinj jar to a version pulled from maven central and face a strange problem. The resulting apk's device compatibility marking is broken.

enter image description here this section shows the change I tried:

// compile "com.google:bitcoinj:0.11.1"
// the above looks like a really good idea, but unfortunately the apk resulting from this
// is broken in the way that it is marked as available only for x86_64 - which are 0 devices
// in google play at the moment - something strange gets pulled in there 

compile files('libs/bitcoinj-0.8.jar')

before investigating what unwanted thing is pulled in here I just wanted to ask here if somebody faced the same thing. Strange only that this seems to be a jar dependency and I do not expect things like this to be pulled - there should be no native code ..

Kymry answered 29/3, 2014 at 11:42 Comment(0)
K
-1

I digged a bit deeper. Bitcoinj pulls in libscrypt. From the bitcoinj pom:

<dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>scrypt</artifactId>
<version>1.3.3</version>
</dependency>

and libscrypt contains native code for x86_64 only:

$> unzip -l scrypt-1.4.0.jar | grep libsc
21708  2013-05-26 12:20   lib/x86_64/darwin/libscrypt.dylib
22140  2013-05-26 12:20   lib/x86_64/freebsd/libscrypt.so
21306  2013-05-26 12:20   lib/x86_64/linux/libscrypt.so

this seems to cause the problem

Kymry answered 2/4, 2014 at 16:9 Comment(0)
S
0

See the README in the scrypt github repo:

"A precompiled native library for Android 2.3 running on ARM is located in src/android/resources/lib/arm5/libscrypt.so. If placed in an .apk file's lib/armeabi directory it will be automatically loaded."

In your project directory (where you find the res subdir) create a libs/armeabi subdir and copy the libscrypt.so to it. Rebuild your project and the resultant apk will have arm as one of the native platforms.

Alex

Steinberg answered 3/6, 2014 at 14:56 Comment(0)
K
-1

I digged a bit deeper. Bitcoinj pulls in libscrypt. From the bitcoinj pom:

<dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>scrypt</artifactId>
<version>1.3.3</version>
</dependency>

and libscrypt contains native code for x86_64 only:

$> unzip -l scrypt-1.4.0.jar | grep libsc
21708  2013-05-26 12:20   lib/x86_64/darwin/libscrypt.dylib
22140  2013-05-26 12:20   lib/x86_64/freebsd/libscrypt.so
21306  2013-05-26 12:20   lib/x86_64/linux/libscrypt.so

this seems to cause the problem

Kymry answered 2/4, 2014 at 16:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.