问题
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.
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 ..
回答1:
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
回答2:
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
来源:https://stackoverflow.com/questions/22730620/bad-apk-when-using-bitcoinj-from-maven-central