服务器安装php环境

下载 android-sdk-windows  下载JDK

1.打开zip支持 c:/windows/php.ini ,打开 exec

2.apk 支持
mime添加 .apk application/vnd.android.package-archive

3.安装javaSDK(要和android的编辑版本一致)

4.编辑IIS绑定权限(www:www) ,目录没有权限会导致生成失败

5.配置两个虚拟主机

A:down.coolaj.cn  用于下载

B:make.cookaj.cn  用于制作签名

6. down的index.php

<?php
/*
* Created on 2012-5-21
* coolaj.cn
*/ // var_dump($id); function cocode() { foreach($_GET as $k=>$v){
$id = $k;
break;
}
if($_GET['u']){
$id=$_GET['u'];
}
if(is_numeric($id)){
return $id;
}elseif ($id && preg_match('/^U/', $id)) {
$id = base64_decode(substr($id,1).'=')>>2;
return $id;
}
} $id = cocode(); if(file_exists('bbshenqi'.$id.".apk") || empty($id)){
if(empty($id)){
header('Location: http://www.coolaj.cn/bbshenqi.apk');
exit;
}
header('Location: http://down.coolaj.cn/bbshenqi'.$id.'.apk');
}else{
$cc =file_get_contents("http://make.coolaj.cn/makeapk.php?apkname=".$id.'&r=简单加密');
if($cc == 'ok'){
if(file_exists('bbshenqi'.$id.".apk")){
echo '<meta http-equiv="content-type" content="text/html; charset=gbk" />';
echo '<a href="http://down.coolaj.cn/bbshenqi'.$id.'.apk">生成失败,点击重试</a>';
exit;
}
header('Location: http://down.coolaj.cn/bbshenqi'.$id.'.apk');
}
} ?>
 

7.makeapk.php

<?php
set_time_limit(0);
function zip($dir,$filename,$missfile=array(),$addfromString=array()){
if(!file_exists($dir) || !is_dir($dir)){
die(' can not exists dir '.$dir);
}
if(strtolower(end(explode('.',$filename))) != 'zip'){
die('only Support zip files');
}
$dir = str_replace('\\','/',$dir);
$filename = str_replace('\\','/',$filename);
if(file_exists($filename)){
die('the zip file '.$filename.' has exists !');
}
$files = array();
getfiles($dir,$files);
if(empty($files)){
die(' the dir is empty');
} $zip = new ZipArchive;
$res = $zip->open($filename, ZipArchive::CREATE);
if ($res === TRUE) {
foreach($files as $v){
if(!in_array(str_replace($dir.'/','',$v),$missfile)){
$zip->addFile($v,str_replace($dir.'/','',$v));
//$zip->addFile($v,str_replace($dir.'/','./',$v));
}
}
if(!empty($addfromString)){
foreach($addfromString as $v){
$zip->addFromString($v[0],$v[1]);
}
}
$zip->close();
//echo 'unsigin apk ok!<br>';
} else {
echo 'failed';
}
} function getfiles($dir,&$files=array()){
if(!file_exists($dir) || !is_dir($dir)){return;}
if(substr($dir,-1)=='/'){
$dir = substr($dir,0,strlen($dir)-1);
}
$_files = scandir($dir);
foreach($_files as $v){
if($v != '.' && $v!='..'){
if(is_dir($dir.'/'.$v)){
getfiles($dir.'/'.$v,$files);
}else{
$files[] = $dir.'/'.$v;
}
}
}
return $files;
} function file_content_replace($filename, $search, $replace){
$string = file_get_contents($filename);
$new_string = str_replace($search, $replace, $string);
if($string !=$new_string) file_put_contents($filename, $new_string);
} function goapk ($file){
exec("del bbshenqi.zip");
exec("del bbshenqi.apk");
exec("del gosign.bat");
exec("del D:\android\apk\bbshenqi\assets\unionid.txt");
exec("copy /Y demo.bat gosign.bat");
file_content_replace("gosign.bat","00000.apk",$file.'.apk');
exec('echo '.$file.'>D:\android\apk\bbshenqi\assets\unionid.txt');
zip("bbshenqi", "bbshenqi.zip");
exec("copy /Y bbshenqi.zip bbshenqi.apk");
exec("gosign.bat");
}
if($_GET['apkname']){
$name = $_GET['apkname'];
$r= $_GET['r'];
if($r=='yourpass'){
goapk($name);
echo 'ok';
} }
exit; ?>
 

8.demo.bat

 
"C:/Program Files/Java/jdk1.6.0_45/bin/jarsigner" -verbose -keystore key.keystore -storepass yourpass -storetype jks -sigfile CERT -signedjar bbshenqi_signed.apk bbshenqi.apk key.keystore
"D:\android\android-sdk-windows\tools\zipalign" -v 4 bbshenqi_signed.apk d:\apk\bbshenqi00000.apk
del bbshenqi_signed.apk
del bbshenqi.apk
 

windows下PHP批量生成打包android程序APK-渠道txt植入apk文件的更多相关文章

  1. windows下使用adb工具查看android程序cpu和内存消耗情况

    在实际的开发当中,尤其软件运行在一个硬件设备比较差的环境下,对软件占用资源大的问题是开发者们必须要解决的问题,系统比较卡.觉得应该看看程序的cpu和内存消耗 一直以来都在windows下编程,已经习惯 ...

  2. MAC下配置gradle用eclipse 打包android程序

    1.下载gradle binhttp://gradle.org/gradle-download/ 2.配置gradle,http://www.douban.com/note/311599602/htt ...

  3. Windows下将ImageMagick移植到Android平台

    Windows下将ImageMagick移植到Android平台 原文链接  http://www.pedant.cn/2014/06/18/imagemagick-ported-android/ I ...

  4. 用Ant手动打包android程序,android分包机制解决65536方法过多异常

    Android利用ant手动打包 首先我们要给自己的IDE eclispe配置ant,默认的eclipse是集成了ant构建工具的,但是google提供的Android集成开发工具ADT,里面封装了E ...

  5. windows下如何批量修改文件名

    windows下如何批量修改文件名 一.总结 一句话总结:就是用excel生成了多条修改文件名的dos命令然后执行,比较核心的就是把图片名称导入excel 将图片名称导入excel---编写如下DOS ...

  6. Windows 下使用OpenSSL生成RSA公钥和私钥

    Windows 下使用OpenSSL生成RSA公钥和私钥 (1)下载OpenSSL 可到该地址下载OpenSSL: https://www.openssl.org/source/(https://ww ...

  7. sencha touch 扩展篇之将sencha touch打包成安装程序(下)- 使用phonegap打包安装程序

        这讲我们来讲解下如何使用phonegapa创建项目环境并通过她们将sencha touch打包成app,这里我们只讲解打包android的apk,打包ios的过程有点类似,但是需要在mac环境 ...

  8. Windows 下使用 mingw+msys 交叉编译 Android Unity Mono

    对于没有升级到 Unity5.4的用户,发布安卓版本都会有对 C# 脚本进行加密的需求,我们项目在裸奔了很长时间后,决定开始做这件事. 网上查看了很多资料,我很希望直接在 windows 下编译而不去 ...

  9. windows下Qt5.1.0配置android环境搭建 good

    1.首先下载好需要配置的软件: 1>Qt 5.1.0 for Android (Windows 32-bit, 716 MB)(Info)下载地址: http://qt-project.org/ ...

随机推荐

  1. 关于tomcat会在url末尾自动追加斜杠(/)

    今天,突然发现一个问题, 比如我的请求路径为  http://ip:port/my_project/myapp, 在浏览器中敲入这个地址,然后会显示 http://ip:port/my_project ...

  2. Svn与Git的一些区别(转载)

    把第一条理解到位思想到位了做起来才会有的放矢,其他几条都是用的时候才能体会到 1) 最核心的区别Git是分布式的,而Svn不是分布的.能理解这点,上手会很容易,声明一点Git并不是目前唯一的分布式版本 ...

  3. Construct Binary Tree from Preorder and Inorder Traversal [LeetCode]

    Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that ...

  4. guava学习--集合2&Range

    转载:http://www.cnblogs.com/peida/p/Guava_ImmutableCollections.html Table: 当我们需要多个索引的数据结构的时候,通常情况下,我们只 ...

  5. systemctl命令

    systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起. 任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 ...

  6. linux 查看剩余内存数

    返回的是kb的数值 cat /proc/meminfo | grep MemFree | cut -d ":" -f2 | sed -e 's/\(^ *\)//' -e 's/\ ...

  7. 0511Scrum项目3.0

    一.product backlog ID name Imp Est how to demo notes 1 主界面 3  3 用来登陆,离开,设置,关于按钮   2 算术界面 5 10 先用背景图来装 ...

  8. UDK:AdventureKit 攀爬系统

    [目标] AdventureKit攀爬系统 [思路] [步骤] 1 拷贝 2 设置config,UDKGame\Config\DefaultEngine.ini 添加包 [UnrealEd.Edito ...

  9. 为什么高手离不了Linux系统?这就是我的理由

    摘要: 通过本文来记录下我在Linux系统的学习经历,聊聊我为什么离不了Linuxx系统,同时也为那些想要尝试Linux而又有所顾忌的用户答疑解惑,下面将为你介绍我所喜欢的Linux系统,这里有一些你 ...

  10. HDU 3308 LCIS

    题意: U A B: 把第A个数变成BQ A B: 输出[A,B]最长连续上升子序列(注意是连续  相当于子串) 思路:单点更新 ,区间合并几下左边开头最小  和右边结束最大的两个数即可. #incl ...