kotlin AndroidManifest 注意事项

Fork Me On Github
zodream 编程技术 Kotlin 2020年07月
  1. android:value 为数字则无法通过字符串获取

例如:

xml
 
<meta-data android:name="XXX" android:value="11543906547"/>
1

获取

kotlin
    
packageManager.getApplicationInfo(
            packageName,
            PackageManager.GET_META_DATA
        ).metaData?.getString("XXX");
1234

返回的值为 null, 因为 Bundle 自动识别为数字

正确的写法是修改 AndroidManifest,前加上 \ (反斜杠和空格)即可

xml
 
<meta-data android:name="XXX" android:value="\ 11543906547"/>
1
点击查看全文
0 361 0
47.0 ms
系统信息
Execution time47.0 ms
CPU usage user + system61 % + 4 %
Peak of allocated memory7.13 MB
Included files226
Classes + interfaces + traits140 + 29 + 26
Your IP13.58.74.190
Server IP172.21.0.9
HTTP method / response codeGET / 200
PHP8.4.2
Zodream5.1.0
Servernginx/1.27.3
运行信息
start0.0 ms
match route21.5 ms
controller response3.6 ms
db engine init6.2 ms
db engine end0.6 ms
db init end0.0 ms
view render5.3 ms
end47.2 ms
Queries(10)
[0.3ms] SELECT * FROM `blog` WHERE id = ? LIMIT 1
[0.22ms] SELECT * FROM `blog_term`
[0.59ms] SELECT term_id,COUNT(*) as count FROM `blog` WHERE parent_id = ? GROUP BY term_id
[0.41ms] SELECT id,language FROM `blog` WHERE parent_id = ?
[0.16ms] SELECT `tag_id` FROM `blog_tag_relationship` WHERE blog_id = ?
[0.18ms] SELECT `content`,`name` FROM `blog_meta` WHERE blog_id = ?
[0.18ms] SELECT id,name,avatar FROM `user` WHERE id in (?)
[0.26ms] SELECT id,title,thumb,parent_id,language,description,created_at FROM `blog` WHERE id < ? and language = ? and publish_status = ? ORDER BY id DESC LIMIT 1
[0.22ms] SELECT id,title,thumb,parent_id,language,description,created_at FROM `blog` WHERE id > ? and language = ? and publish_status = ? ORDER BY id ASC LIMIT 1
[0.21ms] SELECT * FROM `ad_position` WHERE code = ? and status = ? LIMIT 1
Views(5)
[Rendered] Module/Blog/UserInterface/layouts/header.php : 0.45ms
[Rendered] Module/Blog/UserInterface/Home/content.php : 2.55ms
[Rendered] Module/Blog/UserInterface/layouts/footer.php : 0.06ms
[Rendered] Module/Blog/UserInterface/Home/detail.php : 7.77ms
[Rendered] UserInterface/Home/layouts/main.php : 1.02ms