RK WITH_DEXPREOPT 预编译

一.编译 user版本 且带Google 服务 报的问题

      Maybe this is library field 'android.app.Notification$Action { android.app.PendingIntent actionIntent; }'
dex2oatd I 196148 196148 art/compiler/plugin_handler.cc:72] Error opening the directory: /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/plugins
dex2oatd I 196148 196148 art/compiler/plugin_handler.cc:72] 
dex2oatd I 196148 196148 art/dex2oat/dex2oat.cc:1412] out/host/linux-x86/bin/dex2oatd --runtime-arg -Xms64m --runtime-arg -Xmx512m --boot-image=out/target/product/rk3288/dex_bootjars/system/framework/boot.art --dex-file=out/target/product/rk3288/obj/APPS/Shell_intermediates/arm/package.odex.input --dex-location=/system/priv-app/Shell/Shell.apk --oat-file=out/target/product/rk3288/obj/APPS/Shell_intermediates/arm/package.odex --android-root=out/target/product/rk3288/system --instruction-set=arm --instruction-set-features=div --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols --compile-pic
Note: android.support.v4.text.ICUCompatIcs accesses a method 'getScript(java.lang.String)' dynamically
      Maybe this is program method 'android.support.v4.text.ICUCompat { java.lang.String getScript(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImpl { java.lang.String getScript(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImplBase { java.lang.String getScript(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImplIcs { java.lang.String getScript(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompatIcs { java.lang.String getScript(java.lang.String); }'
Note: android.support.v4.text.ICUCompatIcs accesses a method 'addLikelySubtags(java.lang.String)' dynamically
      Maybe this is program method 'android.support.v4.text.ICUCompat { java.lang.String addLikelySubtags(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImpl { java.lang.String addLikelySubtags(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImplBase { java.lang.String addLikelySubtags(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompat$ICUCompatImplIcs { java.lang.String addLikelySubtags(java.lang.String); }'
      Maybe this is program method 'android.support.v4.text.ICUCompatIcs { java.lang.String addLikelySubtags(java.lang.String); }'
Note: com.android.camera.util.SystemProperties accesses a method 'get(java.lang.String,java.lang.String)' dynamically
      Maybe this is program method 'com.android.camera.util.SystemProperties { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is program method 'com.android.ex.camera2.portability.util.SystemProperties { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is library method 'java.util.prefs.AbstractPreferences { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is library method 'java.util.prefs.Preferences { java.lang.String get(java.lang.String,java.lang.String); }'
Note: com.android.ex.camera2.portability.LegacyVendorTags accesses a field 'CONTROL_SCENE_MODE_HDR' dynamically
      Maybe this is program field 'com.android.ex.camera2.portability.LegacyVendorTags { int CONTROL_SCENE_MODE_HDR; }'
      Maybe this is library field 'android.hardware.camera2.CameraMetadata { int CONTROL_SCENE_MODE_HDR; }'
Note: com.android.ex.camera2.portability.util.SystemProperties accesses a method 'get(java.lang.String,java.lang.String)' dynamically
      Maybe this is program method 'com.android.camera.util.SystemProperties { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is program method 'com.android.ex.camera2.portability.util.SystemProperties { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is library method 'java.util.prefs.AbstractPreferences { java.lang.String get(java.lang.String,java.lang.String); }'
      Maybe this is library method 'java.util.prefs.Preferences { java.lang.String get(java.lang.String,java.lang.String); }'
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792] compiler [Exclusive time] [Total time]
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]   0.257s/1.221s dex2oat Setup
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.099s Resolve MethodsAndFields
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.239s Verify Dex File
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.007s InitializeNoClinit
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.571s Compile Dex File
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0s/0.008s dex2oat OatWriter
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0s Loading image checksum
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0s InitOatHeader
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0s InitOatDexFiles
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0s InitDexFiles
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0.002s InitOatClasses
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0.003s InitOatMaps
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0s InitOatCode
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]       0.003s InitOatCodeDexFiles
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.035s Writing ELF
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792]     0.001s Patching ELF
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792] compiler: end, 1.221s
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:1792] 
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] dex2oat took 1.221s (threads: 16) arena alloc=405KB java alloc=563KB native alloc=1374KB free=1861KB
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] Code dedupe: 0 collisions, 0 max bucket size, 1001926 ns hash time
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] Source mapping table dedupe: 0 collisions, 0 max bucket size, 543899 ns hash time
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] Mapping table dedupe: 0 collisions, 0 max bucket size, 490378 ns hash time
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] Vmap table dedupe: 0 collisions, 0 max bucket size, 481668 ns hash time
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] GC map dedupe: 0 collisions, 0 max bucket size, 465208 ns hash time
dex2oatd I 196081 196081 art/dex2oat/dex2oat.cc:291] CFI info dedupe: 0 collisions, 0 max bucket size, 0 ns hash time
dex2oatd I 195104 195493 art/compiler/dex/mir_graph.cc:2001] Topological sort order: Using fall-back in void acfd.a(java.util.Set, java.util.List, java.lang.String, int, java.lang.String, boolean, akja, acfg, java.util.LinkedHashMap, boolean) BB #65 @0xe1a, num_blocks = 1240
Reading library jar [/home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar]
Install: out/target/product/rk3288/system/priv-app/ManagedProvisioning/arm/ManagedProvisioning.odex
dex2oatd I 195104 195493 art/compiler/dex/quick/codegen_util.cc:643] Missing native PC for catch entry @ 0xc9b
dex2oatd I 195104 195493 art/compiler/dex/quick/codegen_util.cc:650] Bad dex2pcMapping table in void acfd.a(java.util.Set, java.util.List, java.lang.String, int, java.lang.String, boolean, akja, acfg, java.util.LinkedHashMap, boolean)
dex2oatd I 195104 195493 art/compiler/dex/quick/codegen_util.cc:651] Entries @ decode: 61, Entries in table: 60
dex2oatd F 195104 195493 art/compiler/dex/quick/codegen_util.cc:737] Check failed: VerifyCatchEntries() 
dex2oatd E 195104 195493 art/runtime/base/mutex-inl.h:119] Lock level violation: holding "abort lock" (level AbortLock - 5) while locking "mutator lock" (level MutatorLock - 47)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] Runtime aborting...
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] Aborting thread:
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] "Compiler driver thread pool worker thread 6" prio=5 tid=8 Native (still starting up)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | group="" sCount=0 dsCount=0 obj=(nil) self=0x5d700468
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | sysTid=195493 nice=0 cgrp=default sched=0/0 handle=0x5c8c5b40
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | state=R schedstat=( 3825071313 10062428814 4412 ) utm=378 stm=4 core=8 HZ=100
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | stack=0x5c7c6000-0x5c7c8000 stackSize=1024KB
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | held mutexes= "abort lock" "mutator lock"(shared held)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #00 pc 00006d56  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+82)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #01 pc 000043f1  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #02 pc 0038a999  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+121)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #03 pc 0035deaa  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+202)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #04 pc 0035dd95  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+53)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #05 pc 003533b9  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*)+41)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #06 pc 0035335f  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+351)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #07 pc 003531f9  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::Dumpable<art::AbortState>::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+41)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #08 pc 00351b88  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (std::__1::basic_ostream<char, std::__1::char_traits<char> >& art::operator<<<art::AbortState>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Dumpable<art::AbortState> const&)+40)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #09 pc 0034b008  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::Runtime::Abort()+168)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #10 pc 000fd589  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::LogMessage::~LogMessage()+393)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #11 pc 00160543  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::Mir2Lir::CreateMappingTables()+4499)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #12 pc 0012153d  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::ArmMir2Lir::AssembleLIR()+4813)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #13 pc 001620f0  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::Mir2Lir::Materialize()+176)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #14 pc 0020ea82  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::CompileMethod(art::CompilerDriver&, art::Compiler const*, art::DexFile::CodeItem const*, unsigned int, art::InvokeType, unsigned short, unsigned int, _jobject*, art::DexFile const&, void*)+2658)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #15 pc 0020e00a  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::CompileOneMethod(art::CompilerDriver*, art::Compiler const*, art::DexFile::CodeItem const*, unsigned int, art::InvokeType, unsigned short, unsigned int, _jobject*, art::DexFile const&, void*)+90)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #16 pc 001a5d81  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::QuickCompiler::Compile(art::DexFile::CodeItem const*, unsigned int, art::InvokeType, unsigned short, unsigned int, _jobject*, art::DexFile const&) const+161)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #17 pc 0023bb85  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::CompilerDriver::CompileMethod(art::DexFile::CodeItem const*, unsigned int, art::InvokeType, unsigned short, unsigned int, _jobject*, art::DexFile const&, art::DexToDexCompilationLevel, bool)+581)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #18 pc 002415c9  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::CompilerDriver::CompileClass(art::ParallelCompilationManager const*, unsigned int)+1113)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #19 pc 0024c49c  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd-compiler.so (art::ParallelCompilationManager::ForAllClosure::Run(art::Thread*)+60)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #20 pc 00372b2b  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::ThreadPoolWorker::Run()+75)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #21 pc 0037291f  /home/gatsby/workspace/ZK_R32X_RK3288_ANDROID5.1/ZK_R32X_RK3288_ANDROID5.1/out/host/linux-x86/lib/libartd.so (art::ThreadPoolWorker::Callback(void*)+95)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #22 pc 00006f5a  /lib32/libpthread-2.19.so (start_thread+202)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   native: #23 pc 000ec52d  /lib32/libc-2.19.so (clone+93)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   (no managed stack frames)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] Dumping all threads without appropriate locks held: thread list lock mutator lock
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] All threads:
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] DALVIK THREADS (16):
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] "main" prio=5 tid=1 Native (still starting up)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | group="" sCount=0 dsCount=0 obj=(nil) self=0x57ed52b8
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | sysTid=195104 nice=0 cgrp=default sched=0/0 handle=0x56283440
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | state=S schedstat=( 4706927808 10269815808 4576 ) utm=463 stm=6 core=8 HZ=100
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | stack=0xffdd5000-0xffdd7000 stackSize=2MB
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | held mutexes=
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] Not able to dump stack of thread that isn't suspended
dex2oatd F 195104 195493 art/runtime/runtime.cc:289] "Compiler driver thread pool worker thread 0" prio=5 tid=2 Native (still starting up)
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | group="" sCount=0 dsCount=0 obj=(nil) self=0x5d100468
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | sysTid=195487 nice=0 cgrp=default sched=0/0 handle=0x5c2c5b40
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | state=S schedstat=( 3514966262 10118041375 4433 ) utm=346 stm=4 core=2 HZ=100
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | stack=0x5c1c6000-0x5c1c8000 stackSize=1024KB
dex2oatd F 195104 195493 art/runtime/runtime.cc:289]   | held mutexes

1.1.

"Compiler driver thread pool worker thread 6" prio=5 tid=8 Native (still starting up  

原因是apk要预置进源码的时候,会对apk进行一个解析,好形成odex文件加速apk的运行,但是基于高版本的sdk开发的apk里面的一些资源是无法被低版本正确的解析的

二.odex 预编译

借鉴 Android 开机速度优化-----ART 预先优化

2.0.#启用dex预优化,以加快第一个引导顺序

把 WITH_DEXPREOPT 改成 false

# Enable dex-preoptimization to speed up first boot sequence
ifeq ($(HOST_OS),linux)
  ifeq ($(TARGET_BUILD_VARIANT), user)
    ifeq ($(WITH_DEXPREOPT),)
      WITH_DEXPREOPT ?= false
      WITH_DEXPREOPT_PIC := false
    endif
  endif
endif

#WITH_DEXPREOPT ?= true
#WITH_DEXPREOPT_PIC := true

2.1.WITH_DEXPREOPT
在BoardConfig.mk里定义

WITH_DEXPREOPT := true

这样整个system image 就会被预先优化. 由于在启动时不再需要进行app的dex文件进行优化(dex2oat操作)从而提升其启动速度

2.2.WITH_DEXPREOPT_PIC
在BoardConfig.mk里定义

WITH_DEXPREOPT :=true
WITH_DEXPREOPT_PIC :=true

在system 有一份OAT file ,在运行时也会copy 一份到/data/ dalvik-cache下.如果内部存储不够,可以enable这个选项.
但是这个选项可能会影响运行时的性能.因为ART 会disable和position相关的优化.

2.3.LOCAL_DEX_PREOPT
控制单个APP是否需要预先优化.如果APP是通过Google play 来进行升级的,或者为了平衡空间问题,
可以在app的Android.mk 中设置如下属性.(小厂不建议升级Google Play)

LOCAL_DEX_PREOPT :=false // 不进行预先优化
LOCAL_DEX_PREOPT :=true // 进行预先优化

  

 

 

 

 

  

posted @ 2021-09-22 11:49  CrushGirl  阅读(675)  评论(0编辑  收藏  举报