我使用MailCore2作为一个邮件Android应用程序。我遵循文档(https://github.com/MailCore/mailcore2/tree/master/build-android)中提供的构建说明。
$ export ANDROID_SDK=/path/to/android-sdk
$ export ANDROID_NDK=/path/to/android-ndk
$ cd build-android
$ ./build.sh
我得到这些消息:
CMake Error at CMakeLists.txt:80 (message):
ERROR: Could not find ctemplate
-- Configuring incomplete, errors occurred!
See also "/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/cmake-build/CMakeFiles/CMakeOutput.log".
cp: /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/cmake-build/src/include/MailCore: No such file or directory
Android NDK: WARNING:/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/Android.mk:MailCore: non-system libraries in linker flags: -lc++_shared
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi] Compile++ thumb: MailCore <= com_libmailcore_AbstractMessage.cpp
In file included from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/TypesUtils.h:7:0,
from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/native/com_libmailcore_AbstractMessage.cpp:3:
/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/core/basetypes/MCBaseTypes.h:5:40: fatal error: MailCore/MCAutoreleasePool.h: No such file or directory
#include <MailCore/MCAutoreleasePool.h>
^
compilation terminated.
make: *** [/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/obj/local/armeabi/objs/MailCore//Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/__/__/src/java/native/com_libmailcore_AbstractMessage.o] Error 1
cp: /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/libs/armeabi/libMailCore.so: No such file or directory
Android NDK: WARNING:/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/Android.mk:MailCore: non-system libraries in linker flags: -lc++_shared
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi-v7a] Compile++ thumb: MailCore <= com_libmailcore_AbstractMessage.cpp
In file included from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/TypesUtils.h:7:0,
from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/native/com_libmailcore_AbstractMessage.cpp:3:
/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/core/basetypes/MCBaseTypes.h:5:40: fatal error: MailCore/MCAutoreleasePool.h: No such file or directory
#include <MailCore/MCAutoreleasePool.h>
^
compilation terminated.
make: *** [/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/obj/local/armeabi-v7a/objs/MailCore//Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/__/__/src/java/native/com_libmailcore_AbstractMessage.o] Error 1
cp: /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/libs/armeabi-v7a/libMailCore.so: No such file or directory
Android NDK: WARNING:/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/Android.mk:MailCore: non-system libraries in linker flags: -lc++_shared
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[x86] Compile++ : MailCore <= com_libmailcore_AbstractMessage.cpp
In file included from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/TypesUtils.h:7:0,
from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/native/com_libmailcore_AbstractMessage.cpp:3:
/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/core/basetypes/MCBaseTypes.h:5:40: fatal error: MailCore/MCAutoreleasePool.h: No such file or directory
#include <MailCore/MCAutoreleasePool.h>
^
compilation terminated.
make: *** [/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/obj/local/x86/objs/MailCore//Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/__/__/src/java/native/com_libmailcore_AbstractMessage.o] Error 1
cp: /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/libs/x86/libMailCore.so: No such file or directory
Android NDK: WARNING:/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/Android.mk:MailCore: non-system libraries in linker flags: -lc++_shared
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[x86_64] Compile++ : MailCore <= com_libmailcore_AbstractMessage.cpp
In file included from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/TypesUtils.h:7:0,
from /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/java/native/com_libmailcore_AbstractMessage.cpp:3:
/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/../../src/core/basetypes/MCBaseTypes.h:5:40: fatal error: MailCore/MCAutoreleasePool.h: No such file or directory
#include <MailCore/MCAutoreleasePool.h>
^
compilation terminated.
make: *** [/Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/obj/local/x86_64/objs/MailCore//Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/jni/__/__/src/java/native/com_libmailcore_AbstractMessage.o] Error 1
cp: /Users/thee/AndroidStudioProjects/JavaMailApp/libs/mailcore2-master/build-android/libs/x86_64/libMailCore.so: No such file or directory
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
它产生二进制mailcore2-android-version.aar
如文档中所述,但我不能在我的项目中使用它。每次我尝试使用mailcore库的函数时,它都会崩溃。
有什么想法吗?
有点晚了,但可能对未来的用户有用:
在build-android/includes
中创建一个'MailCore'目录。然后在src/
目录下执行(对于OS X):
cp `find . -name '*.h'` ../build-android/includes/MailCore/
它对我有效!
如果是在Mac OS X上,你可以下载缺少的组件CTemplate(这里)和 libbetpan (这里;如果稍后弹出该错误)。安装这些组件为我解决了这些错误。