android framework 快速调试(批处理脚本)

继上一篇说道的批处理脚本大笑

注意事项:

1.脚本要放在java项目的根目录下

2.需要拷贝debug jar至脚本的同级目录

3.需要装adb,否则有些命令无法执行


@echo off
setlocal enabledelayedexpansion

	echo ****************************************
	echo *       author:chenxuesong             *
	echo *       email :cqupt_chen@163.com      *
	echo *       qq    :704179713               *
	echo ****************************************
	
	echo the file in system/framework you want replace :
	set /p debugjar=
	
	if not exist %debugjar% (
		echo debug jar %debugjar% not found!
		goto :error
	)
	
	:begin
	echo choose the class copy method.
	echo 1.copy the all class file in dir \bin 
	echo 2.use the special file to appointed class
	echo what is your chooce : 
	set /p choose=
	if %choose%==1 (
		echo copy the all class file in dir \bin 
		goto :copyall
	)else (
		if %choose%==2 (
			echo use the special file to appointed class
			echo appointed class file:
			set /p updatefile=
			goto :copyfromfile
		)else (
			echo please inter the number 1 or 2!
			goto :begin
		)
	)
	:copyall
	echo copying files to %debugjar%
	zip a %debugjar% .\bin\*
	echo copy files done.
	goto :generatedex
	:copyfromfile
	if not exist %updatefile% (
		echo appointed class file %updatefile% not found.
		goto :error
	)
	echo copying files to %debugjar%
	for /f %%i in (%updatefile%) do (
		cd ./bin
 		echo copying package %%i
 		set package=%%i
 		set classpath=!package:.=\!
 		echo package to filepath !classpath!
 		copy ..\zip.exe .
 		zip a ..\%debugjar% !classpath!\*
 		cd ..
	)
	del .\bin\zip.exe
	pause
	echo copy files done.
	goto :generatedex
	:generatedex
	echo genersting dex file.
	call dx --dex --output=%cd%\tmp.jar %cd%\%debugjar%
	echo dex file has generated.
	echo press any key to push dex file to mobile and reboot it
	pause
	del %debugjar%
	ren tmp.jar %debugjar%
	adb shell mount -o remount /
	adb shell mount -o remount rwx /system
	adb push %cd%\%debugjar% /system/framework
	adb shell reboot
	goto :end
	:error
	echo something wrong!
	
:end
echo press any key to exit
pause

顺便学了一下批处理,脚本只会一点python.考虑到python不是每台机器上都有.所以试试批处理 尴尬

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值