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

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

注意事项:

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

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

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


@echo off
setlocal enabledelayedexpansion

	echo ****************************************
	echo *       author:chenxuesong             *
	echo *       email :[email protected]      *
	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不是每台机器上都有.所以试试批处理

你可能感兴趣的:(android,ics)