Android Studio — ручной интерфейс C ++ Binder, но не может найти Binder и некоторые другие библиотеки

Я пытаюсь сгенерировать реализацию C ++ файла интерфейса .aidl. Но я не могу заставить работать aidl-cpp ……

поэтому я написал реализацию C ++, заголовочный файл и исходный файл. Как показано ниже:

#ifndef SMAPLE_X_NEIGHBORING_CELL_INFO_H
#define SMAPLE_X_NEIGHBORING_CELL_INFO_H

#include <cstdint>
#include <string>

#include <binder/Parcelable.h>
#include <utils/Errors.h>
#include <utils/String16.h>

namespace android {
namespace telephony {
class NeighboringCellInfo : public Parcelable {
public:
NeighboringCellInfo() = default;
NeighboringCellInfo(const std::string& name, int32_t number);
virtual ~NeighboringCellInfo() = default;
// Write |this| parcelable to the given |parcel|.  Keep in mind that
// implementations of writeToParcel must be manually kept in sync
// with readFromParcel and the Java equivalent versions of these methods.
//
// Returns android::OK on success and an appropriate error otherwise.
status_t writeToParcel(Parcel* parcel) const override;

// Read data from the given |parcel| into |this|.  After readFromParcel
// completes, |this| should have equivalent state to the object that
// wrote itself to the parcel.
//
// Returns android::OK on success and an appropriate error otherwise.
status_t readFromParcel(const Parcel* parcel) override;

std::string toString() const;

friend bool operator==(const NeighboringCellInfo& lhs,
const NeighboringCellInfo& rhs) {
return (lhs.name_ == rhs.name_) && (lhs.number_ == rhs.number_);
}
friend bool operator!=(const NeighboringCellInfo& lhs,
const NeighboringCellInfo& rhs) {
return !(lhs == rhs);
}

private:
String16 name_;
int32_t number_ = 0;
}
}
}

#endif

и соседний_клет_инфо.cpp, как показано ниже:

#include "neighboring_cell_info.h"
namespace android {
namespace telephony {

NeighboringCellInfo::NeighboringCellInfo(const std::string& name, int32_t number)
: name_(name.c_str(), name.length()),
number_(number) {}

status_t NeighboringCellInfo::writeToParcel(Parcel* parcel) const {
status_t status = parcel->writeString16(name_);
if (status != OK) {
return status;
}
status = parcel->writeInt32(number_);
return status;
}

status_t NeighboringCellInfo::readFromParcel(const Parcel* parcel) {
status_t status = parcel->readString16(&name_);
if (status != OK) {
return status;
}
return parcel->readInt32(&number_);
}

std::string NeighboringCellInfo::toString() const {
return StringPrintf("%s(%d)", String8(name_).string(), number_);
}

}  // namespace telephony
}  // namespace android

мое положение файлов .aidl показывает на этой картинке:мой макет файлов помощи

вопрос как ниже:

    #include <binder/Parcelable.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.

не только «связующее», многие другие библиотеки не могут быть решены в IDE.многие библиотеки не могут быть решены
Кто-нибудь может помочь?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector