问题
Here is log1 aplication output:
: ... 25 more
W/System.err( 1500): java.lang.ClassNotFoundException: android.graphics.drawable.VectorDrawable
W/System.err( 1500): at java.lang.Class.classForName(Native Method)
W/System.err( 1500): at java.lang.Class.forName(Class.java:217)
W/System.err( 1500): at java.lang.Class.forName(Class.java:172)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getClass(ExtractStyle.java:388)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:94)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 1500): Caused by: java.lang.NoClassDefFoundError: android/graphics/drawable/VectorDrawable
W/System.err( 1500): ... 25 more
W/System.err( 1500): Caused by: java.lang.ClassNotFoundException: android.graphics.drawable.VectorDrawable
W/System.err( 1500): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
W/System.err( 1500): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
W/System.err( 1500): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
W/System.err( 1500): ... 25 more
W/System.err( 1500): java.lang.NoSuchFieldException: View_paddingStart
W/System.err( 1500): at java.lang.Class.getDeclaredField(Class.java:631)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getField(ExtractStyle.java:427)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:173)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 1500): java.lang.NoSuchFieldException: View_paddingEnd
W/System.err( 1500): at java.lang.Class.getDeclaredField(Class.java:631)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getField(ExtractStyle.java:427)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:174)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 1500): GC_CONCURRENT freed 494K, 14% free 5744K/6663K, paused 81ms+191ms, total 320ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 18ms
W/ResourceType( 1500): Skipping entry 0x10804c7 in package table 0 because it is not complex!
D/dalvikvm( 1500): GC_CONCURRENT freed 462K, 14% free 5843K/6727K, paused 34ms+3ms, total 75ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 18ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 541K, 15% free 5829K/6791K, paused 18ms, total 18ms
D/dalvikvm( 1500): GC_CONCURRENT freed 409K, 13% free 5932K/6791K, paused 55ms+3ms, total 95ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 40ms
D/dalvikvm( 1500): GC_CONCURRENT freed 501K, 14% free 5990K/6919K, paused 67ms+2ms, total 100ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 36ms
D/dalvikvm( 1500): GC_CONCURRENT freed 544K, 15% free 5999K/6983K, paused 2ms+3ms, total 63ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 44ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 477K, 14% free 6032K/6983K, paused 17ms, total 18ms
D/dalvikvm( 1500): GC_CONCURRENT freed 479K, 14% free 6065K/6983K, paused 63ms+2ms, total 106ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 489K, 14% free 6072K/7047K, paused 19ms, total 20ms
D/dalvikvm( 1500): GC_CONCURRENT freed 438K, 13% free 6137K/7047K, paused 31ms+3ms, total 72ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 299K, 14% free 6143K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 30K, 14% free 6156K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 38K, 14% free 6149K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 499K, 14% free 6158K/7111K, paused 20ms, total 21ms
D/dalvikvm( 1500): GC_CONCURRENT freed 531K, 14% free 6138K/7111K, paused 17ms+3ms, total 80ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 63ms
I/Adreno200-EGL( 1500): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_2.0.3_RB3.04.01.01.42.006_msm7627a_JB_REL_2.0.3_Merge_release_AU (Merge)
I/Adreno200-EGL( 1500): Build Date: 04/01/13 Mon
I/Adreno200-EGL( 1500): Local Branch:
I/Adreno200-EGL( 1500): Remote Branch: m/jb_rel_2.0.3
I/Adreno200-EGL( 1500): Local Patches: NONE
I/Adreno200-EGL( 1500): Reconstruct Branch: NOTHING
I/Choreographer( 1500): Skipped 31 frames! The application may be doing too much work on its main thread.
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-8------------------------------------
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-9------------------------------------
W/IInputConnectionWrapper( 1500): getCursorCapsMode on inactive InputConnection
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-2------------------------------------
F/libc ( 1500): Fatal signal 11 (SIGSEGV) at 0x007a7a76 (code=1), thread 1567 (le.testAndroid4)
I/DEBUG ( 147): pid: 1500, tid: 1567, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<
"org.qtproject.example.testAndroid4" died.
log1 compile output:
Android package built successfully in 29.282 ms.
-- It can now be run from the selected device/emulator.
-- File: C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/android-build//bin/QtApp-debug.apk
3064 KB/s (15889430 bytes in 5.064s)
11:15:26: The process "C:/Qt/5.5/android_armv7/bin/androiddeployqt.exe" exited normally.
11:15:26: Pulling files necessary for debugging.
11:15:26: Package deploy: Running command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/bin/sh: readlink: not found C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/app_process".
11:15:26: Packaging error: Command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/bin/sh: readlink: not found C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/app_process" failed.Exit code: 1
11:15:26: Package deploy: Running command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/lib/libc.so C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/libc.so".
11:15:26: Elapsed time: 00:53.
log2 application output:
...
I/Adreno200-EGL( 3188): Build Date: 04/01/13 Mon
I/Adreno200-EGL( 3188): Local Branch:
I/Adreno200-EGL( 3188): Remote Branch: m/jb_rel_2.0.3
I/Adreno200-EGL( 3188): Local Patches: NONE
I/Adreno200-EGL( 3188): Reconstruct Branch: NOTHING
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-8------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-9------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-2------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-3------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-4------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-5------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-10------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-1------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-11------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-12------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-2------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-3------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-4------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-5------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-13------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-14------------------------------------
F/libc ( 3188): Fatal signal 11 (SIGSEGV) at 0xdeadcab1 (code=1), thread 3269 (le.testAndroid4)
I/DEBUG ( 147): pid: 3188, tid: 3269, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<
I/ActivityManager( 457): Process org.qtproject.example.testAndroid4 (pid 3188) has died.
"org.qtproject.example.testAndroid4" died.
Now the source code:
logindialog.h
#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#include <QDialog>
#include <QDebug>
namespace Ui {
class loginDialog;
}
class loginDialog : public QDialog
{
Q_OBJECT
public:
explicit loginDialog(QWidget *parent = 0);
~loginDialog();
bool isDecrypted();
std::string getPassword();
private slots:
void on_passwordButton_clicked();
private:
Ui::loginDialog *ui;
bool decrypted;
std::string password;
};
#endif // LOGINDIALOG_H
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <fstream>
//#include <sha.h>
//#include <pwdbased.h>
//#include <osrng.h>
//#include <sstream>
//#include <iomanip>
//#include <cryptlib.h>
//using CryptoPP::Exception;
//#include <hex.h>
//using CryptoPP::HexEncoder;
//using CryptoPP::HexDecoder;
//#include <filters.h>
//using CryptoPP::StringSink;
#include "logindialog.h"
#include <QMessageBox>
#include <QDebug>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_2_clicked();
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
bool getEnterPassword(std::string &);
};
#endif // MAINWINDOW_H
logindialog.cpp
#include "logindialog.h"
#include "ui_logindialog.h"
loginDialog::loginDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::loginDialog)
{
ui->setupUi(this);
}
loginDialog::~loginDialog()
{
delete ui;
}
void loginDialog::on_passwordButton_clicked()
{
qDebug() << "-----------------------------P-2------------------------------------";
this->password = ui->lineEdit->text().toStdString();
qDebug() << "-----------------------------P-3------------------------------------";
this->decrypted = true; //TODO decrypt the file and if there is exception set as false
qDebug() << "-----------------------------P-4------------------------------------";
this->accept();
qDebug() << "-----------------------------P-5------------------------------------";
}
bool loginDialog::isDecrypted()
{
return this->decrypted;
}
std::string loginDialog::getPassword()
{
return this->password;
}
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
byte ivec[16];
byte salt[32];
CryptoPP::OS_GenerateRandomBlock(false, salt, sizeof(salt));
CryptoPP::OS_GenerateRandomBlock(false, ivec, sizeof(ivec));
std::string v;
CryptoPP::HexEncoder hex(new CryptoPP::StringSink(v));
hex.Put(salt, sizeof(salt));
hex.MessageEnd();
QMessageBox::about(this,tr("Test1"),tr(v.c_str()));
QMessageBox::about(this,tr("Test1"),tr("XXX"));
}
void MainWindow::on_pushButton_2_clicked()
{
std::string password;
if(getEnterPassword(password)==false)
{
QMessageBox::about(this,tr("Failed"),tr("Password does not match!"));
}
else
{
QMessageBox::about(this,tr("Failed"),tr("Password match!"));
}
}
bool MainWindow::getEnterPassword(std::string &password)
{
loginDialog passwordWindow;
qDebug() << "-----------------------------P-8------------------------------------";
passwordWindow.setModal(true);
qDebug() << "-----------------------------P-9------------------------------------";
passwordWindow.exec();
qDebug() << "-----------------------------P-10------------------------------------";
qDebug() << "-----------------------------P-1------------------------------------";
loginDialog passwordWindowRe;
qDebug() << "-----------------------------P-11------------------------------------";
passwordWindowRe.setModal(true);
qDebug() << "-----------------------------P-12------------------------------------";
passwordWindowRe.exec();
qDebug() << "-----------------------------P-13------------------------------------";
//qDebug() << passwordWindow.getPassword().c_str();
//qDebug() << passwordWindowRe.getPassword().c_str();
qDebug() << "-----------------------------P-14------------------------------------";
if(passwordWindow.getPassword() == passwordWindowRe.getPassword())
{
qDebug() << "-----------------------------P-15------------------------------------";
password = passwordWindow.getPassword();
qDebug() << "-----------------------------P-16------------------------------------";
return true;
qDebug() << "-----------------------------P-17------------------------------------";
}
else
{
qDebug() << "-----------------------------P-18------------------------------------";
return false;
}
}
And the most important: testAndroid4.pro
#-------------------------------------------------
#
# Project created by QtCreator 2015-12-02T17:56:00
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testAndroid4
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
logindialog.cpp
HEADERS += mainwindow.h \
logindialog.h
FORMS += mainwindow.ui \
logindialog.ui
CONFIG += mobility
MOBILITY =
INCLUDEPATH += C:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\include\
LIBS += -LC:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\armeabi-v7a\lib -lssl
LIBS += -LC:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\armeabi-v7a\lib -lcrypto
ANDROID_EXTRA_LIBS += C:\Users\niki\Downloads\android-ndk-r10e\sources\cxx-stl\stlport\libs\armeabi-v7a\libstlport_shared.so
ANDROID_EXTRA_LIBS += C:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\lib1\libcryptopp.so
INCLUDEPATH += C:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\include\cryptopp\
LIBS += -LC:\Users\niki\Downloads\android-ndk-r10e\sources\cxx-stl\stlport\libs\armeabi-v7a -lstlport_shared
LIBS += -LC:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\lib1 -lcryptopp
DISTFILES += \
../../../../Temp/cryptopp/cryptopp-5.6.2-android-14/cryptopp-android-14/lib1/libcryptopp.so
When I start the program and press pushButton2 it appears logindialog. When I enter something into it and press logindialog's button the program is dieing. If I comment in .pro file the cryptopp lines the program works properly. If I leave empty the lineEdit and push passwordButton of logindialog, it again ask me about password and I give blank, but again die - see the second log appears(notice the P1,P2,P3... in both logs). I took openssl from this link and criptopp from this. I think the problem is somewhere with cryptopp. How can I increase stack and heap size for qt android? I don't think this is the issue and have read something about "stack trace debuging" but don't know how to do it. Never mind, what could be the issue in this case?
After edition:
I have tested it on my android 4.1.2 device LG optimus L1 e410. No matter if I test it on AVD with android 23/14/18/16 -> it is failing. If cryptopp is commented all goes OK. log2 compile output is same as first one with difference in time only.
After edition 2:
Application log for cryptopp usage for pushButton:
I/Adreno200-EGL( 6066): Reconstruct Branch: NOTHING
W/IInputConnectionWrapper( 6066): showStatusIcon on inactive InputConnection
F/libc ( 6066): Fatal signal 11 (SIGSEGV) at 0x54ff002e (code=1), thread 6156 (le.testAndroid4)
I/DEBUG ( 147): pid: 6066, tid: 6156, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<
I/ActivityManager( 457): Process org.qtproject.example.testAndroid4 (pid 6066) has died.
"org.qtproject.example.testAndroid4" died.
See pushButton in mainwindow.cpp and commented thigs in mainwindow.h(they are not commented really).
回答1:
You are manually loading libstlport_shared.so
, I suppose it's because it is needed by libcryptopp.so
.
By default Qt, uses a STL library (libgnustl_shared.so
in my case, you can check this in your android-build\libs\armeabi-v7a folder after compilation) upon compilation and deployment. If your crypto library uses a different one (apparently libstlport_shared.so
), loading it manually from the .pro file as you did (ANDROID_EXTRA_LIBS +=
, LIB +=
) will make the libcryptopp.so
loadable, but you'll most likely get a seg fault whenever you'll pass a STL object (std::string
for instance) from your code to a crypto function.
Two environments (your code and crypto one) are not using the same STL implementation, so they cannot safely send any STL object to each other without a serious potential segmentation fault (as one will consider objects as created from its own implementation when it was actually created with the other one: objects will most likely have different attributes....it's like forcing a cast between two completely different types).
You can verify this like that:
void MainWindow::on_pushButton_clicked()
{
byte ivec[16];
byte salt[32];
qDebug() << "Calling OS_GenerateRandomBlock";
CryptoPP::OS_GenerateRandomBlock(false, salt, sizeof(salt));
qDebug() << "Calling OS_GenerateRandomBlock";
CryptoPP::OS_GenerateRandomBlock(false, ivec, sizeof(ivec));
std::string v;
qDebug() << "Passing std::string to CryptoPP::StringSink";
CryptoPP::StringSink* sink = new CryptoPP::StringSink(v);
qDebug() << "Creating HexEncoder";
CryptoPP::HexEncoder hex( sink );
hex.Put(salt, sizeof(salt));
hex.MessageEnd();
QMessageBox::about(this,tr("Test1"),tr(v.c_str()));
QMessageBox::about(this,tr("Test1"),tr("XXX"));
}
Please confirm, but I'm pretty sure you'll see "Passing std::string to CryptoPP::StringSink" but not "Creating HexEncoder".
You should recompile libcryptopp.so
to have it use the same STL implmentation as your main program (and cross your finger that the lib will work with that STL implementation).
来源:https://stackoverflow.com/questions/34048195/cryptopp-fatal-signal-11