readium-sdk
readium-sdk copied to clipboard
Android Build doc is out of date
This issue is a Bug
Related issue(s) and/or pull request(s)
None
Expected Behaviour
Builds docs should be accurate and up-to-date
Observed behaviour
Instead the doc is inaccurate
Steps to reproduce
- Follow the steps in the doc
- Build fails
Test file(s)
Doc is here
Product
Android Launcher
Additional information
None
Also need to check that the iOS and OSX docs are current as well.
Did you get it to build? Where is the inaccuracy?
Thanks, Patrick Keating CTO, Bluefire Productions www.bluefirereader.comhttp://www.bluefirereader.com 206.781.1411
@bluefirepatrick : I have not yet tried it. The problem was reported by Jean-Marie.
@jmgeffroy Can you provide details on what is wrong?
@rkwright Yes. When following the instructions, I got:
Android NDK: ERROR:/Applications/android-sdk-macosx/ndk-bundle/sources/cxx-stl/gnu-libstdc++/Android.mk:epub3: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /Users/Shared/dvpts/sandbox/SDKLauncher-Android/readium-sdk/Platform/Android/epub3/libs/armeabi-v7a/libepub3.so exists or that its path is correct
make: Entering directory `/Users/Shared/dvpts/sandbox/SDKLauncher-Android/readium-lcp-client/platform/android/lcp'
make: Leaving directory `/Users/Shared/dvpts/sandbox/SDKLauncher-Android/readium-lcp-client/platform/android/lcp'
:lcp:buildMk FAILED
Which made me think I had to first build libepub3 separately. It surprised me slightly but I tried. But When building libepub3 I got a mysterious mesage:
A problem occurred configuring project ':lib'.
> failed to find target with hash string '23' in: /Applications/android-sdk-macosx
As Android-ers know, the target platforms are named 'android-23' etc. And if you google fr this err message you'll see that people get errors such as "failed to find target with hash string 'android-23'", never simply "failed to find target with hash string '23'". And the answer is always to simply install the appropriate platform thruigh the Android SDK manager or its AS equivalent. But after struggling a little bit with that, I realized that I could try to use ndk.experimental=true. This saved my day. So since I only wanted to get a running launcher, and then see how to integrate bits and pieces into our own apps, I stopped my investigations.
@bluefirepatrick Hi Patrick, yes I got it working very simply, Daniel and Cyril have done a great job with the gradle build files.
On notable point is that with ndk.experimental=true
in local.properties
, traditional "makefiles" are not used (e.g. Android.mk
or Application.mk
or Stable.mk
or Experimental.mk
), which means that the ndk-build
command is not invoked directly from our specially-crafted Gradle task.
Instead, we have a fully-centralised Gradle-powered NDK build, which is nice (all src definitions and static/dynamic lib dependencies). Plus, we can configure via a simple set of parameters whether to use Clang vs. GCC, and whether to skip x86 or ARM build targets (to save time, when we only need to test the app on an emulator or a physical device).
Examples:
ReadiumSDK:
https://github.com/readium/readium-sdk/blob/feature/lcp/Platform/Android/epub3/build_experimental.gradle#L1
and the actual "experimental" switch (the buildMk
Gradle task which handles the mk
makefiles is only invoked with the so-called "stable" plugin):
https://github.com/readium/readium-sdk/blob/feature/lcp/Platform/Android/epub3/build.gradle#L143
if (ndk_experimental) {
println "${project.name} - ${taskName}: Using Gradle EXPERIMENTAL, no need to invoke external NDK / Makefile to build EPUB3 lib"
task.dependsOn "buildIncludes"
} else {
task.dependsOn "buildMk"
}
LCP client lib: https://github.com/readium/readium-lcp-client/blob/develop/platform/android/lcp/build_experimental.gradle#L1 and the actual "experimental" switch: https://github.com/readium/readium-lcp-client/blob/develop/platform/android/lcp/build.gradle#L47
if (ndk_experimental) {
println "${project.name} - ${taskName}: Using Gradle EXPERIMENTAL, no need to invoke external NDK / Makefile to build LCP lib"
} else {
task.dependsOn "buildMk"
}
@danielweck Hi Daniel, I realize that for those (like me today) who want to build the readium-sdk independently from the launcher
- Instructions are obsolete since they refer to ndk-compile.sh, which doesn't exist anymore (like the .mk files)
- there are no instructions explaining how to build just this readium-sdk module with Gradle. It would probably be handy. I could write them but I must first succeed ;-) (I currently build with very different gradle scripts in our own apps)