这是log1应用输出:

   :    ... 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编译输出:

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应用程序输出:

 ...
    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.


现在的源代码:

登录对话框

#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


主窗口

#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;
}


主窗口

#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;
}
}


最重要的是:
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


当我启动程序并按pushButton2时,将显示logindialog。当我在其中输入内容并按logindialog的按钮时,程序将消失。如果我在.pro文件中注释cryptopp行,则程序可以正常运行。如果我将lineEdit留空并按下logindialog的passwordButton,它将再次询问我有关密码的信息,但我却给出了空白,但又死了-看到第二个日志出现(注意两个日志中的P1,P2,P3 ...)。我从this链接中获取了openssl,从this中获取了criptopp。我认为问题出在cryptopp。如何增加Qt Android的堆栈和堆大小?我不认为这是问题所在,并且已经阅读了有关“堆栈跟踪调试”的内容,但不知道该怎么做。没关系,在这种情况下可能是什么问题?

版本后:

我已经在我的android 4.1.2设备LG optimus L1 e410上进行了测试。不管我是否在Android 23/14/18/16的AVD上测试它->都失败了。如果对cryptopp进行注释,则一切正常。 log2编译输出与第一个相同,只是时间有所不同。

版本2之后:

按钮的cryptopp使用情况的应用程序日志:

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.


参见mainwindow.cpp中的pushButton和mainwindow.h中的注释提要(它们并未真正注释)。

最佳答案

您正在手动加载libstlport_shared.so,我想是因为libcryptopp.so需要它。

默认情况下,Qt在编译和部署时使用STL库(在本例中为libgnustl_shared.so,您可以在编译后在android-build \ libs \ armeabi-v7a文件夹中检查它)。如果您的密码库使用其他密码库(显然是libstlport_shared.so),则像您一样从.pro文件手动加载(ANDROID_EXTRA_LIBS +=LIB +=)将使libcryptopp.so可加载,但是您很可能会得到每当您将STL对象(例如,std::string)从代码传递到加密函数时,都会发生段错误。

两种环境(您的代码和加密的一种)没有使用相同的STL实现,因此它们无法安全地相互发送任何STL对象,而不会出现严重的分段错误(因为人们会认为对象实际上是从其自己的实现中创建的)与另一个对象一起创建:对象很可能具有不同的属性。。。就像在两个完全不同的类型之间强制转换一样。

您可以这样验证:

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"));
}


请确认,但是我很确定您会看到“将std :: string传递给CryptoPP :: StringSink”,而不是“ Creating HexEncoder”。

您应该重新编译libcryptopp.so以使其使用与您的主程序相同的STL实施(并尽力使lib与该STL实现一起使用)。

关于c++ - Cryptopp致命信号11,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34048195/

10-10 09:53