修改包名可以采用包名替换的方式:
public class PackageUtil {
public static String orgPackageName1="com.zcdog.smartlocker.android";
public static String orgPackageName2="com.zcdog.zchat";
public static String destPackageName1="com.wangwang.tv.android";
public static String destPackageName2="com.wangwang.zchat";
public static String packageReplace(String className){
if (className!=null&&!className.isEmpty()){
if (className.contains(orgPackageName1)){
return className.replaceAll(orgPackageName1,destPackageName1);
}
if (className.contains(orgPackageName2)){
return className.replaceAll(orgPackageName2,destPackageName2);
}
}
return className;
}
}