1.å¦ä½å Android init.rc-ljbphoebe-ChinaUnixå客
2.uniapp离线本地打包[二] - android离线打包流程
3.Android移å¨å¼åå¾çintå表示
å¦ä½å Android init.rc-ljbphoebe-ChinaUnixå客
ããCommands:å½ä»¤
ããActions: å¨ä½
ããTriggers: 触åæ¡ä»¶
ããServices: æå¡
ããOptions: é项
ããPropertise: å±æ§
ãã(1) Commandsæ¯ä¸äºåºæ¬çæä½ï¼ä¾å¦ï¼
ããmkdir /sdcard system system mkdir /system
ããmkdir /data system system
ããmkdir /cache system cache
ããmkdir /config root root
ããmkdir /sqlite_stmt_journals root root
ããmount tmpfs tmpfs /sqlite_stmt_journals size=4m
ããè¿äºå½ä»¤å¨initå¯æ§è¡ç¨åºä¸è¢«è§£æï¼ç¶åè°ç¨ç¸å ³çå½æ°æ¥å®ç°ã
ãã(2) Actions(å¨ä½)表示ä¸ç³»åçå½ä»¤ï¼é常å¨Triggersï¼è§¦åæ¡ä»¶ï¼ä¸è°ç¨ï¼å¨ä½å触åæ¡ä»¶çå½¢å¼ä¸ºï¼
ããon
ãã
ãã
ãã
ããå¨ä½ç使ç¨ç¤ºä¾å¦ä¸ï¼
ããon init
ããexport PATH /sbin:/system/sbin:/system/bin:/system/xbin
ããmkdir /system
ããinit表示ä¸ä¸ªè§¦åæ¡ä»¶ï¼è¿ä¸ªè§¦åäºä»¶åçåï¼è¿è¡è®¾ç½®ç¯å¢åéå建ç«ç®å½çæä½ç§°ä¸ºä¸ä¸ªâå¨ä½â
ãã(3) Servicesï¼æå¡ï¼é常表示å¯å¨ä¸ä¸ªå¯æ§è¡ç¨åºï¼Optionsï¼é项ï¼æ¯æå¡çéå å 容ï¼ç¨äºé åæå¡ä½¿ç¨ã
ããservice vold /system/bin/vold
ããsocket vold stream root mount
ããservice bootsound /system/bin/playmp3
ããuser media
ããgroup audio
ããoneshot
ããvoldåbootsoundåå«æ¯ä¸¤ä¸ªæå¡çå称ï¼/system/bin/voldå/system /bin/playmp3åå«æ¯ä»ä»¬æ对åºçå¯æ§è¡ç¨åºã
ããsocketãuserãgroupãoneshotå°±æ¯é åæå¡ä½¿ç¨çé项ãå ¶ä¸oneshoté项表示该æå¡åªå¯å¨ä¸æ¬¡ï¼èå¦æ没æoneshoté项ï¼
ããè¿ä¸ªå¯æ§è¡ç¨åºä¼ä¸ç´åå¨--å¦æå¯æ§è¡ç¨åºè¢«ææ»ï¼åä¼éæ°å¯å¨ã
ãã(4) Propertiesï¼å±æ§ï¼æ¯ç³»ç»ä¸ä½¿ç¨çä¸äºå¼ï¼å¯ä»¥è¿è¡è®¾ç½®å读åã
ããsetprop ro.FOREGROUND_APP_MEM
ããsetprop ro.VISIBLE_APP_MEM
ããon property:ro.kernel.qemu=1
ããstart adbd
ããsetprop ç¨äºè®¾ç½®å±æ§ï¼on propertyå¯ä»¥ç¨äºå¤æå±æ§ï¼è¿éçå±æ§å¨æ´ä¸ªAndroidç³»ç»è¿è¡ä¸é½æ¯ä¸è´çã
ããinitèæ¬çå ³é®åå¯ä»¥åèinitè¿ç¨çsystem/core/init/keyword.hæ件ã
ããinit.rcç使ç¨æ¹æ³ï¼å¯ä»¥åè说ææ件system/core/init/readme.txt
ããå¦ææ³è¦ä¿®æ¹å¯å¨è¿ç¨åªéè¦ä¿®æ¹init.cï¼system/core/initï¼æè init.rcéçå 容å³å¯.
ããå¦ä½å»å
ããAndroid init.rc (Android init language)
ããAndroid åå§åè¯è¨ç±å大类声æç»æ : è¡ä¸ºç±» (Actions), å½ä»¤ç±» (Commands) ï¼æå¡ç±» (Services), é项类 (Options).
ãã* åå§åè¯è¨ä»¥è¡ä¸ºåä½ï¼ç±ä»¥ç©ºæ ¼é´éçè¯è¨ç¬¦å·ç»æã C é£æ ¼çåææ 转ä¹ç¬¦å¯ä»¥ç¨æ¥æå ¥ç©ºç½å°è¯è¨ç¬¦å·ãåå¼å·ä¹å¯ä»¥ç¨æ¥é²æ¢ææ¬è¢«ç©ºæ ¼åæå¤ä¸ªè¯è¨ç¬¦å·ãå½åææ å¨è¡æ«æ¶ï¼ä½ä¸ºæè¡ç¬¦ã
ãã* 以 # å¼å§ ( åé¢å 许æç©ºæ ¼ ) çè¡ä¸ºæ³¨éè¡ã
ãã* Actions å Services éå«å£°æä¸ä¸ªæ°ç段è½ãææ该段è½ä¸ Commands æ Options ç声æå±äºè¯¥æ®µè½ã第ä¸æ®µè½åç Commands æOptions 被忽ç¥ã
ãã* Actions å Services æ¥æç¬ä¸æ äºçå½åãå¨å®ä»¬ä¹å声æç¸åå½åçç±»å°è¢«å½ä½é误并忽ç¥ã
ããActions
ãã-------
ããActions æ¯ä¸ç³»åå½ä»¤çå½åã Actions æ¥æä¸ä¸ªè§¦åå¨ (trigger) ç¨æ¥å³å® action ä½æ¶æ§è¡ãå½ä¸ä¸ª action å¨ç¬¦å触åæ¡ä»¶è¢«æ§è¡æ¶ï¼å¦æå®è¿æ²¡è¢«å å ¥å°å¾ æ§è¡éåä¸çè¯ï¼åå å ¥å°éåæåã
ããéåä¸ç action ä¾æ¬¡æ§è¡ï¼ action ä¸çå½ä»¤ä¹ä¾æ¬¡æ§è¡ã Init å¨æ§è¡å½ä»¤çä¸é´å¤çå ¶å®æ´»å¨ ( 设å¤å建 / éæ¯ ,property 设置ï¼è¿ç¨éå¯) ã
ããActions 表ç°å½¢å¼ä¸ºï¼
ããon
ãã
ãã
ãã
ãã
ããServices
ãã--------
ããServices æ¯ç± init å¯å¨ï¼å¨å®ä»¬éåºæ¶éå¯ ( å¯é ) ã Service 表ç°å½¢å¼ä¸º :
ããservice [ ]
*ãã
ãã
ãã...
ãã
ããOptions
ãã-------
ããOptions æ¯ Services ç修饰ï¼å®ä»¬å½±å init ä½æ¶ãå¦ä½è¿è¡ service.
ãã
ããcritical
ããè¿æ¯ä¸ä¸ªè®¾å¤å ³é®æå¡ (device-critical service) . å¦æå®å¨ 4 åéå éåºè¶ è¿ 4 次ï¼è®¾å¤å°éå¯å¹¶è¿å ¥æ¢å¤æ¨¡å¼ã
ãã
ããdisabled
ããè¿ä¸ªæå¡ç级å«å°ä¸ä¼èªå¨å¯å¨ï¼å®å¿ 须被ä¾ç §æå¡åæå®å¯å¨æå¯ä»¥å¯å¨ã
ãã
ããsetenv
ãã设置已å¯å¨çè¿ç¨çç¯å¢åé çå¼
ãã
ããsocket [ [ ] ]
ããå建ä¸ä¸ªå为 /dev/socket/ ç unix domin socket ï¼å¹¶ä¼ éå®ç fd å°å·²å¯å¨çè¿ç¨ã å¿ é¡»ä¸º "dgram" æ "stream". ç¨æ·åç»é»è®¤ä¸º 0.
ãã
ããuser
ããå¨æ§è¡æå¡åæ¹åç¨æ·åãå½åé»è®¤ä¸º root. å¦æä½ çè¿ç¨éè¦ linux è½åï¼ä½ ä¸è½ä½¿ç¨è¿ä¸ªå½ä»¤ãä½ å¿ é¡»å¨è¿æ¯ root æ¶è¯·æ±è½åï¼å¹¶ä¸éå°ä½ éè¦ç uid.
ãã
ããgroup [ ]
*ããå¨æ§è¡æå¡åæ¹åç»ãå¨ç¬¬ä¸ä¸ªç»åçç»å°è®¾ä¸ºè¿ç¨éå ç» ( éè¿ setgroups()). å½åé»è®¤ä¸º root.
ãã
ããoneshot
ããå¨æå¡éåºåä¸éå¯ã
ãã
ããclass
ãã为 service æå®ä¸ä¸ªç±»å«åãåæ ·ç±»åçææçæå¡å¯ä»¥ä¸èµ·å¯å¨æåæ¢ãå¦æ没ææå®ç±»å«çæå¡é»è®¤ä¸º "default" ç±»ã
ãã
ããonrestart
ããå½æå¡éå¯æ¶æ§è¡ä¸ä¸ªå½ä»¤ã
ãã
ããTriggers
ãã--------
ããTriggers( 触åå¨ ) æ¯ä¸ä¸ªå符串ï¼å¯ä»¥ç¨æ¥å¹é æç§ç±»åçäºä»¶å¹¶æ§è¡ä¸ä¸ª action ã
ãã
ããboot
ããè¿æ¯å½ init å¼å§åæ§è¡ç第ä¸ä¸ªè§¦åå¨ ( å½ /init.conf 被å è½½ )
ãã
ãã=
ããå½ property 被设为æå®çå¼ æ¶è§¦åã
ãã
ããdevice-added-
ããdevice-removed-
ããå½è®¾å¤èç¹è¢«æ·»å æ移é¤æ¶è§¦åã
ãã
ããservice-exited-
ããå½æå®çæå¡åå¨æ¶è§¦å
ãã
ãã
ããCommands
ãã--------
ãã
ããexec [ ]
*ããFork 并æ§è¡ä¸ä¸ªç¨åº (). è¿å°è¢« block ç´å°ç¨åºæ§è¡å®æ¯ãæ好é¿å æ§è¡ä¾å¦å 建å½ä»¤ä»¥å¤çç¨åºï¼å®å¯è½ä¼å¯¼è´ init 被é»å¡ä¸å¨ã
ãã
ããexport
ãã设å®å ¨å±ç¯å¢åé çå¼ ï¼å½è¿ä¸ªå½ä»¤æ§è¡åææçè¿ç¨é½å¯ä»¥åå¾ã
ãã
ããifup
ãã使ç½ç»æ¥å£ èæºã
ãã
ããimport
ãã解æä¸ä¸ª init é ç½®æ件ï¼æ©å±å½åé ç½®æ件ã
ãã
ããhostname
ãã设置主æºå
ãã
ããchmod
ããæ¹åæ件访é®æé
ãã
ããchown
ããæ¹åæ件æå±åç»
ãã
ããclass_start
ããå½æå®ç±»å«çæå¡æ²¡æè¿è¡ï¼å¯å¨è¯¥ç±»å«ææçæå¡ã
ãã
ããclass_stop
ããå½æå®ç±»å«çæå¡æ£å¨è¿è¡ï¼åæ¢è¯¥ç±»å«ææçæå¡ã
ãã
ããdomainname
ãã设置ååã
ãã
ããinsmod
ããå è½½è¯¥è·¯å¾ ç模å
ãã
ããmkdir [mode] [owner] [group]
ããå¨ å建ä¸ä¸ªç®å½ , å¯éé项 :mod,owner,group. å¦æ没ææå®ï¼ç®å½ä»¥ æéï¼ owner 为 root,group 为 root å建 .
ãã
ããmount
ãã[ ]
*ããå°è¯ mount å°ç®å½
ãã. å¯ä»¥ç¨ mtd@name æ ¼å¼ä»¥å½åæå®ä¸ä¸ª mtd å设å¤ã å å«"ro","rw","remount","noatime".
ããä¾å¦ï¼
ããmount -t vfat -o fmask=,dmask=,rw,flush,noatime,nodiratime /dev/block/mmcblk1p1 /SD1
ããchown system system /SD1
ããchmod /SD1
ããmount -t vfat -o fmask=,dmask=,rw,flush,noatime,nodiratime /dev/block/mmcblk1p6 /SD3
ããchown system system /SD3
ããchmod /SD3
ããsetkey
ããææ¶æ²¡æ
ãã
ããsetprop
ããè®¾ç½®ç³»ç» property çå¼ .
ãã
ããsetrlimit
ãã设置 resource ç rlimit.
ãã
ããstart
ããå¯å¨ä¸ä¸ªæ²¡æè¿è¡çæå¡ã
ãã
ããstop
ããåæ¢ä¸ä¸ªæ£å¨è¿è¡çæå¡ã
ãã
ããsymlink
ããå建ä¸ä¸ª ç符å·é¾æ¥å°
ãã
ããsysclktz
ãã设置系ç»æ¶åº (GMT 为 0)
ãã
ããtrigger
ãã触åä¸ä¸ªäºä»¶ãç¨äºè°ç¨å ¶å® action ã
ãã
ããwrite [ ]
*ããæå¼ çæ件并åå ¥ä¸ä¸ªæå¤ä¸ªå符串ã
ããProperties
ãã----------
ããInit ä¼æ´æ°ä¸äºç³»ç» property 以æä¾æ¥çå®æ£å¨å¹²åã
ããinit.action
ããå½åæ£å¨æ§è¡ç action, å¦æ没æå为 ""
ãã
ããinit.command
ãã被æ§è¡çå½ä»¤ï¼å¦æ没æå为 ""
ãã
ããinit.svc.
ããå½å为 çæå¡çç¶æ ("stopped", "running", "restarting")
ãã
ãã
ããinit.rc ç¤ºä¾ :
ãã-----------------
ãã
ãã# not complete -- just providing some examples of usage
ãã#
ããon boot
ããexport PATH /sbin:/system/sbin:/system/bin
ããexport LD_LIBRARY_PATH /system/lib
ãã
ããmkdir /dev
ããmkdir /proc
ããmkdir /sys
ãã
ããmount tmpfs tmpfs /dev
ããmkdir /dev/pts
ããmkdir /dev/socket
ããmount devpts devpts /dev/pts
ããmount proc proc /proc
ããmount sysfs sysfs /sys
ãã
ããwrite /proc/cpu/alignment 4
ãã
ããifup lo
ãã
ããhostname localhost
ããdomainname localhost
ãã
ããmount yaffs2 mtd@system /system
ããmount yaffs2 mtd@userdata /data
ãã
ããimport /system/etc/init.conf
ãã
ããclass_start default
ãã
ããservice adbd /sbin/adbd
ããuser adb
ããgroup adb
ãã
ããservice usbd /system/bin/usbd -r
ããuser usbd
ããgroup usbd
ããsocket usbd
ãã
ããservice zygote /system/bin/app_process -Xzygote /system/bin --zygote
ããsocket zygote
ãã
ããservice runtime /system/bin/runtime
ããuser system
ããgroup system
ãã
ããon device-added-/dev/compass
ããstart akmd
ãã
ããon device-removed-/dev/compass
ããstop akmd
ãã
ããservice akmd /sbin/akmd
ããdisabled
ããuser akmd
ããgroup akmd
ãã
ããè°è¯
ãã---------------
ããé»è®¤æ åµä¸ï¼ init æ§è¡çç¨åºè¾åºçä¿¡æ¯åéè¯¯å° /dev/null. ä¸ºäº debug ï¼ä½ å¯ä»¥éè¿ Android ç¨åº logwrapper æ§è¡ä½ çç¨åºãè¿å°å¤ä½åè¾åº / é误è¾åºå° Android logging ç³»ç» ( éè¿ logcat è®¿é® ) ã
ãã
ãã
ãã===============================================================
ããAndroidââinit.rcèæ¬
ãã
ããå¨Androidä¸ä½¿ç¨å¯å¨èæ¬init.rcï¼å¯ä»¥å¨ç³»ç»çåå§åä¸è¿è¡ç®åçæä½ã
ããinit.rcå¯å¨èæ¬è·¯å¾ï¼system/core/rootdir/init.rc
ããå 容ï¼
ããCommands:å½ä»¤
ããActionsï¼å¨ä½
ããTriggersï¼è§¦åæ¡ä»¶
ããServices:æå¡
ããOptionsï¼é项
ããPropertiesï¼å±æ§
ããCommandsæ¯ä¸äºåºæ¬æä½ãå¦ï¼
ããmkdir /system
ããmkdir /data system system
ããmkdir /persist system system
ããdevwait /dev/block/mmcblk0p
ããmount ext3 /dev/block/mmcblk0p
ããAction表示ä¸ç³»åå½ä»¤ï¼é常å¨Triggersä¸è°ç¨ï¼å¦ï¼
ããon init //表示ä¸ä¸ªè§¦åæ¡ä»¶
ããsysclktz 0
ããloglevel 3
ãã# setup the global environment
ããexport PATH /sbin:/system/sbin:/system/bin:/system/xbin
ããexport LD_LIBRARY_PATH /system/lib
ããexport ANDROID_BOOTLOGO 1
ããServicesé常表示å¯å¨ä¸ä¸ªå¯æ§è¡ç¨åºï¼Optionsæ¯æå¡çéå å 容ï¼ç¨äºé åæå¡ä½¿ç¨ã
ããservice vold /system/bin/vold //voldæ¯æå¡å称ï¼/system/bin/voldæ¯æ对åºçå¯æ§è¡ç¨åºã
ããsocket vold stream root mount //socketæ¯é åæå¡ä½¿ç¨çé项
ããioprio be 2
ããservice netd /system/bin/netd
ããsocket netd stream root system
ããé åæå¡ä½¿ç¨çé项æsocketï¼userï¼groupï¼oneshotã
ããoneshot表示该æå¡åªå¯å¨ä¸æ¬¡ï¼èå¦æ没æoneshoté项ï¼è¿ä¸ªå¯æ§è¡ç¨åºå°ä¸ç´åå¨ââå¦æå¯æ§è¡ç¨åºè¢«ææ»ï¼åä¼éæ°å¯å¨ã
ããPropertiesæ¯ç³»ç»ä¸ä½¿ç¨çä¸äºå¼ï¼å¯ä»¥è¿è¡è®¾ç½®å读åã
ããsetprop ro.HIDDEN_APP_MEM //setpropç¨äºè®¾ç½®å±æ§
ããsetprop ro.CONTENT_PROVIDER_MEM
ããsetprop ro.EMPTY_APP_MEM
ãã...
ããon property:ro.kernel.qemu=1 //on propertyç¨äºå¤æå±æ§
ããstart adbd
ããè¿éçå±æ§å¨æ´ä¸ªandroidç³»ç»è¿è¡ä¸é½æ¯ä¸è´çã
ããinitèæ¬çå ³é®åå¯ä»¥åèinitè¿ç¨ä¸çsystem/core/init/keyword.hæ件ãå¦ï¼
ããKEYWORD(chroot, COMMAND, 1, do_chroot) //chrootæ¯å½ä»¤ï¼do_chrootï¼ï¼æ¯è°ç¨çå½æ°ï¼è¿ä¸ªå½æ°å¨initè¿ç¨ä¸çsystem/core/init/builtins.cæ件ä¸å®ä¹ã
ããä¾å¦:
ããservice akmd /system/bin/logwrapper /sbin/akmd
uniapp离线本地打包[二] - android离线打包流程
第一步:下载所需文件-打包前准备工作
步骤一:下载 Android 离线SDK - 正式版 解压至你想要存放的地方
步骤二:复制粘贴文件夹中的HBuilder-Integrate-AS项目,然后修改其命名,我这里就叫demo-AS
步骤三:将demo-AS项目在android中打开
第二步:uni项目配置信息-打包前准备工作
步骤一:创建项目,已有项目可忽略此步骤
步骤二:创建keystore文件
到这里大家就需要创建一个keystore文件并拿到相关信息,呆呆打僵尸源码已有可以跳过
1.打开一个自己要存放文件的地方,打开cmd,输入
keytool -genkey -alias 你的别名 -keyalg RSA -keysize -validity 有效期( = 1年。建议时间填长一些) -keystore 你的文件名.keystore
之后直接keytool -list -v -keystore 文件名.keystore,拿到MD5,SHA1,SHA内容复制下来
第三步:登录 开发者中心 找到对应自己的项目,确认后选择第二项点击右上角新增,填写对应信息
包名可在图3获取,月返源码包名可修改,但要保证唯一性,不知道图3在什么位置的可以打开HBuilder X编辑器,上方选择栏中 点击 然后 点击 即可
确认完后即可点击创建离线打包key,然后可查看android的quake 3 源码key值
第四步:生成本地打包app资源
步骤一:看图,点击生成即可,生成后会有一个路径地址,点击可以获取到该文件的内容
将resources文件夹下的文件,复制粘贴到自己的android项目中
第五步:开始配置安卓打包信息
步骤一:复制的文件替换你项目的_UNI_A,删除_UNI_A文件
步骤二:进入dcloud_control.xml文件夹下,福利分红源码将appid替换成自己项目的appid
步骤三:应用名称修改
步骤四:替换包名,离线打包key
步骤五:bulid.gradle文件下,修改包名,版本信息等,下方signingConfigs的game源码网内容可以不管,我们是通过java已经生成了证书文件,如果你就是jks文件,那么就在这个地方填写上你的相关信息
第六步:解决打包前问题
问题一:Build 没有 Generate Signed Bundle / APK...
找到该文件,然后添加 android.overridePathCheck=true
问题二:java jdk版本问题导致的与gradle版本不兼容
一,二解决后:File中找到Sync Project with Gradle Files 一下
此时就会开始给你安装你所需的gradle文件,完成后如图所示,此时就可以进行安卓正常的打包流程操作了
问题三:当处理完所有的操作后,正常是可以打包的,但打包时会出现这么一个问题
问题三:解决方法
这个问题原因是gradle和gradle插件版本的问题,但我试了升级版本,好像uniapp项目不合适。
将这串代码粘贴至 图中位置 --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
百度了很多篇文章之后找到了上述的解决版本
第六步:打包 - 选择uniapp项目的keystore文件,输入密码,别名,创建至此,关于uniapp安卓端本地离线打包结束
Android移å¨å¼åå¾çintå表示
æ¨å¥½ï¼è¯·åèæ¬æ®µè½ï¼
/
*** ç¨åºå ¥å£
*
* @author talentClass
*/
public class MainActivity extends AppCompatActivity implements GameLayout.GameListener {
public static final String SCORE = "score";
/
*** 模å¼ï¼false为æ°åï¼true为å¾ç
*/
private boolean bType;
private TextView tvScore, tvMaxScore; // å½ååæ°ãæé«å
private Button btnType, btnRestart; // 设置类åãéæ°å¼å§
private GameLayout mGameLayout; // èªå®ä¹View容å¨
// æ¾ç½®å¾ççæ°ç»
private int[] mImages = { R.mipmap.image1, R.mipmap.image2, R.mipmap.image3, R.mipmap.image4, R.mipmap.image5, R.mipmap.image6,
R.mipmap.image7, R.mipmap.image8, R.mipmap.image9, R.mipmap.image, R.mipmap.image};