I am using the SMTP Client project to create a library file (.dll) on Windows. Everything works fine and e-mails are sent successfully.
I want to port my Qt project to Android and since Android is a different architecture I need to build the library using a Android armv7 toolkit.
I try this, but I get error:
Internal Error: Unknown Android deployment JSON file location. Error while building/deploying project SMTPEmail (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.4.2)) When executing step "Build Android APK"
I suspect there is something I have to add/remove from the project file. I see there is a "win32:CONFIG += dll", but nothing similar for other platforms.
The .pro files looks like this:
#-------------------------------------------------
#
# Project created by QtCreator 2011-08-11T20:59:25
#
#-------------------------------------------------
QT += core network
TARGET = SMTPEmail
# Build as an application
#TEMPLATE = app
# Build as a library
TEMPLATE = lib
DEFINES += SMTP_BUILD
win32:CONFIG += dll
QMAKE_CXXFLAGS += -fPIC
SOURCES += \
src/emailaddress.cpp \
src/mimeattachment.cpp \
src/mimefile.cpp \
src/mimehtml.cpp \
src/mimeinlinefile.cpp \
src/mimemessage.cpp \
src/mimepart.cpp \
src/mimetext.cpp \
src/smtpclient.cpp \
src/quotedprintable.cpp \
src/mimemultipart.cpp \
src/mimecontentformatter.cpp \
HEADERS += \
src/emailaddress.h \
src/mimeattachment.h \
src/mimefile.h \
src/mimehtml.h \
src/mimeinlinefile.h \
src/mimemessage.h \
src/mimepart.h \
src/mimetext.h \
src/smtpclient.h \
src/SmtpMime \
src/quotedprintable.h \
src/mimemultipart.h \
src/mimecontentformatter.h \
src/smtpexports.h
OTHER_FILES += \
LICENSE \
README.md
FORMS +=
If you just want to make a successful compilation of your shared library without considering subsequent steps, there is a workaround:
Go to Qt Creator's -> Project -> Build -> Build Steps. Disable "Make install" and "Build Android APK".
It appears that there is a regression in Qt Creator when building a shared library for Android: It used to work with Qt Creator 3.0 (based on Qt 5.2) or earlier releases, but stops working with Qt Creator 3.1 (based on Qt 5.3) or the newer Qt Creator 3.4 (based on Qt 5.5).
Hope this bug will be fixed in future releases of Qt Creator.
I managed to solve it by removing corresponding records in
projectname.pro.user
file.apk
attribute andinstall
attribute. Not the attributes, but the elements containing thembuild apk
andinstall
steps in the project's build configurationI also made sure there are no extra projectname.pro.user.* files and removed them, but I don't know if that matters.
Thanks @jonathanzh for the hint in his answer
As commented in the OP, I had the same problem and could fix it by simply adding an application to my project.
My original project was a simple .pro file targetting a library (tinyxml). With Qt 5.2.1 (Qt Creator 3.0.1), I was able to compile the library for Android (creating a .so file). With Qt 5.5.0 (Qt Creator 3.4.0), I had the same error message as reported in the OP.
Here is my solution:
I created another .pro file targetting a dummy program:
mockup_app.pro:
main.cpp:
toplevel.pro:
Then, open toplevel.pro. Go to "Projects" tab, select "Run" and then select "mockup_app" as "Run configuration".
Now, you can right-click the library project and select "Compile": .so file will be created.
Looks like the problem is that "Run configuration" (absent from earlier QtCreator versions) needs an app to be selected....and when there is none, a lib is selected and then compilation does not even start.
Edit 07-20-2015: It's a Qt bug, I filled a bug report: https://bugreports.qt.io/browse/QTCREATORBUG-14710 and it was fixed. Next release of QtCreator should be fine.