Issue
I follow the official build instractions to recompile the library. In my case:
> export ANDROID_SDK=$HOME/Library/Android/sdk
> export ANDROID_NDK=$ANDROID_SDK/ndk-bundle
> ./build.sh
And get some errors during the compilation like:
[arm64-v8a] Compile++ : MailCore <= MCIMAPAsyncSession.cpp
In file included from /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../include/MailCore/MCObject.h:11:0,
from /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../include/MailCore/MCAutoreleasePool.h:5,
from /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../include/MailCore/MCBaseTypes.h:5,
from /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.h:13,
from /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp:9:
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp: In member function 'virtual void mailcore::IMAPAsyncSession::automaticConfigurationDone(mailcore::IMAPSession*)':
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp:874:87: warning: 'virtual mailcore::String* mailcore::IMAPSession::gmailUserDisplayName()' is deprecated (declared at /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/core/imap/MCIMAPSession.h:196) [-Wdeprecated-declarations]
MC_SAFE_REPLACE_COPY(String, mGmailUserDisplayName, session->gmailUserDisplayName());
^
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../include/MailCore/MCUtils.h:8:27: note: in definition of macro 'MC_SAFE_COPY'
#define MC_SAFE_COPY(o) ((o) != NULL ? (o)->copy() : NULL)
^
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp:874:5: note: in expansion of macro 'MC_SAFE_REPLACE_COPY'
MC_SAFE_REPLACE_COPY(String, mGmailUserDisplayName, session->gmailUserDisplayName());
^
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp:874:87: warning: 'virtual mailcore::String* mailcore::IMAPSession::gmailUserDisplayName()' is deprecated (declared at /Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/core/imap/MCIMAPSession.h:196) [-Wdeprecated-declarations]
MC_SAFE_REPLACE_COPY(String, mGmailUserDisplayName, session->gmailUserDisplayName());
^
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../include/MailCore/MCUtils.h:8:41: note: in definition of macro 'MC_SAFE_COPY'
#define MC_SAFE_COPY(o) ((o) != NULL ? (o)->copy() : NULL)
^
/Users/nikolay/Documents/Mailcore/mailcore2/build-android/jni/../../src/async/imap/MCIMAPAsyncSession.cpp:874:5: note: in expansion of macro 'MC_SAFE_REPLACE_COPY'
MC_SAFE_REPLACE_COPY(String, mGmailUserDisplayName, session->gmailUserDisplayName());
^
... compiling goes ok...
... and again some errors...
And so on. Finally I get:
[arm64-v8a] StaticLibrary : libstdc++.a
[arm64-v8a] SharedLibrary : libMailCore.so
[arm64-v8a] Install : libMailCore.so => libs/arm64-v8a/libMailCore.so
warning: [options] bootstrap class path not set in conjunction with -source 1.6
com/libmailcore/MainThreadUtils.java:3: error: package android.os does not exist
import android.os.Handler;
^
com/libmailcore/MainThreadUtils.java:4: error: package android.os does not exist
import android.os.Looper;
^
com/libmailcore/MainThreadUtils.java:5: error: package android.util does not exist
import android.util.Log;
^
com/libmailcore/MainThreadUtils.java:10: error: cannot find symbol
private Handler handler;
^
symbol: class Handler
location: class MainThreadUtils
com/libmailcore/MainThreadUtils.java:21: error: cannot find symbol
handler = new Handler(Looper.getMainLooper());
^
symbol: class Handler
location: class MainThreadUtils
com/libmailcore/MainThreadUtils.java:21: error: cannot find symbol
handler = new Handler(Looper.getMainLooper());
^
symbol: variable Looper
location: class MainThreadUtils
6 errors
1 warning
How can I recompile the library? In the end I want to fix a text relocations error but it doesn't even make a clean build
Solution
It's looking for Android platforms 16 and 21, and can't find them, that's why it shows the error message:
error: package android.os does not exist
These are usually installed in the folder $ANDROID_SDK/platforms
(Add this near the top of build-android/build.sh
, to see what it's doing:
set -v
set -x
This will show the commands it's running, and the contents of shell variables.)
If you open the file build-android/build.sh
, inside Mailcore2, you'll see lines like:
# Start building.
ANDROID_PLATFORM=android-16
archs="armeabi armeabi-v7a x86"
Replace android-16
with whatever version you have installed, or even better, install android-16
because it's expecting that.
Also the armeabi
platform support has been removed from the latest Android NDK, and it gives me errors about it. So remove armeabi
and leave only armeabi-v7a
and x86
.
Also further down there is:
ANDROID_PLATFORM=android-21
archs="arm64-v8a"
and:
ANDROID_PLATFORM=android-16
cd "$current_dir/../src/java"
...
So it's easiest to install android-16
and android-21
to fix this issue.
I was also getting the error:
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16.
Finding this line:
$ANDROID_NDK/ndk-build TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
And adding APP_PLATFORM
to it, like so, fixed that error:
$ANDROID_NDK/ndk-build TARGET_PLATFORM=$ANDROID_PLATFORM APP_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
I was also getting the error:
*** Android NDK: Invalid NDK_TOOLCHAIN_VERSION value: 4.9. GCC is no longer supported. See https://android.googlesource.com/platform/ndk/+/master/docs/ClangMigration.md. . Stop.
Apparently GCC is no longer supported. I installed clang, and it proceeded to compile the project after that, but stopped on another error.
Additionally, I had to remove the line containing:
NDK_TOOLCHAIN_VERSION=4.9 \
as described here.
I received the error:
MailCore2/build-android/jni/../../src/java/TypesUtils.cpp:84:32: error: member access into incomplete type 'const std::type_info'
MCLog("info name: %s", info->name());
^
This is apparently related to this issue:
GCC just seems to implicitly declare std::type_info
. You usually encounter this problem the first time when doing a typical Hello World with Clang and libstdc++. – Xeo Feb 26 '13 at 20:42
I wasn't able to resolve this issue yet, but I'll update this post when I get the chance.
Answered By - gregn3
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.