mmm framework/base 报错 android9.0 单编framework报错解决办法

毋城
2023-12-01

1 android9.0 单独编译framework报错解决办法

mmm frameworks/base 报错

1.1 报错信息

frameworks/base/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp:463:32: error: 'onNewImageSnapshot' marked 'override' but does not override any member functions
        virtual sk_sp<SkImage> onNewImageSnapshot() override {
                               ^
frameworks/base/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp:463:32: error: 'RenderNodeDrawable_projectionHwLayer_RenderThreadTest::doTheThing(renderthread::RenderThread &)::ProjectionLayer::onNewImageSnapshot' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
external/skia/src/image/SkSurface_Base.h:49:28: note: hidden overloaded virtual function 'SkSurface_Base::onNewImageSnapshot' declared here: different number of parameters (1 vs 0)
    virtual sk_sp<SkImage> onNewImageSnapshot(const SkIRect* subset = nullptr) = 0;
                           ^
frameworks/base/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp:530:40: error: allocating an object of abstract class type 'ProjectionLayer'
    sk_sp<SkSurface> surfaceLayer1(new ProjectionLayer(&drawCounter));
                                       ^
external/skia/src/image/SkSurface_Base.h:49:28: note: unimplemented pure virtual method 'onNewImageSnapshot' in 'ProjectionLayer'
    virtual sk_sp<SkImage> onNewImageSnapshot(const SkIRect* subset = nullptr) = 0;
                           ^
3 errors generated.
[ 41% 2049/4888] target dex2oat: out/target/product/xxxxxx_xxx/dex_bootjars/system/framework/arm/boot.art
ninja: build stopped: subcommand failed.
11:20:44 ninja failed with: exit status 1

#### failed to build some targets (08:18 (mm:ss)) ####

1.2 解决办法

// 用 /* */  注释掉 frameworks/base/libs/hwui/Android.bp cc_test{***} 就可以编译。
/*
 cc_test {
xxx
xxx
xxx
 }
*/

1.3 测试编译

touch frameworks/base/core/res/res/values-zh-rCN/strings.xml
mmm frameworks/base

[100% 11/11] Install: out/target/product/xxxxxx/system/framework/framework-res.apk

build completed successfully (01:35 (mm:ss))

编译成功了!!!

 类似资料: