tag120
This commit is contained in:
parent
940929a50b
commit
9b5171ac54
|
@ -30,6 +30,20 @@ android {
|
|||
|
||||
buildTypes {
|
||||
release {
|
||||
buildConfigField("int", "TAG", "119")
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
debug {
|
||||
buildConfigField("int", "TAG", "120")
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
create("home") {
|
||||
buildConfigField("int", "TAG", "120")
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
|
@ -56,7 +70,7 @@ android {
|
|||
variant.outputs.all {
|
||||
val versionName = variant.versionName
|
||||
val versionCode = variant.versionCode
|
||||
val outputFileName = "app-${variant.applicationId}-v${versionName}-${versionCode}.apk"
|
||||
val outputFileName = "Grape-${variant.name}-v${versionName}-${versionCode}.apk"
|
||||
|
||||
if (this is ApkVariantOutputImpl) {
|
||||
this.outputFileName = outputFileName
|
||||
|
|
|
@ -319,55 +319,6 @@ object FileUtils {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向文件中添加内容
|
||||
*
|
||||
* @param strcontent 内容
|
||||
* @param filePath 地址
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
fun writeToFile(strcontent: String, filePath: String, fileName: String) {
|
||||
//生成文件夹之后,再生成文件,不然会出错
|
||||
val strFilePath = filePath + fileName
|
||||
|
||||
// 每次写入时,都换行写
|
||||
val subfile = File(strFilePath)
|
||||
|
||||
|
||||
var raf: RandomAccessFile? = null
|
||||
try {
|
||||
/** 构造函数 第二个是读写方式 */
|
||||
raf = RandomAccessFile(subfile, "rw")
|
||||
/** 将记录指针移动到该文件的最后 */
|
||||
raf.seek(subfile.length())
|
||||
/** 向文件末尾追加内容 */
|
||||
raf.write(strcontent.toByteArray())
|
||||
|
||||
raf.close()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改文件内容(覆盖或者添加)
|
||||
*
|
||||
* @param path 文件地址
|
||||
* @param content 覆盖内容
|
||||
* @param append 指定了写入的方式,是覆盖写还是追加写(true=追加)(false=覆盖)
|
||||
*/
|
||||
fun modifyFile(path: String?, content: String?, append: Boolean) {
|
||||
try {
|
||||
val fileWriter = FileWriter(path, append)
|
||||
val writer = BufferedWriter(fileWriter)
|
||||
writer.append(content)
|
||||
writer.flush()
|
||||
writer.close()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件内容
|
||||
|
@ -380,19 +331,6 @@ object FileUtils {
|
|||
return File(filePath, filename).takeIf { it.exists() }?.readText() ?: ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件
|
||||
*
|
||||
* @param oldPath 原来的文件地址
|
||||
* @param newPath 新的文件地址
|
||||
*/
|
||||
fun renameFile(oldPath: String, newPath: String) {
|
||||
val oleFile = File(oldPath)
|
||||
val newFile = File(newPath)
|
||||
//执行重命名
|
||||
oleFile.renameTo(newFile)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 复制文件
|
||||
|
@ -472,54 +410,6 @@ object FileUtils {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解压缩一个文件
|
||||
*
|
||||
* @param zipFile 压缩文件
|
||||
* @param folderPath 解压缩的目标目录
|
||||
* @return
|
||||
* @throws IOException 当解压缩过程出错时抛出
|
||||
*/
|
||||
@Throws(IOException::class)
|
||||
fun upZipFile(zipFile: File?, folderPath: String): ArrayList<File> {
|
||||
val fileList = ArrayList<File>()
|
||||
val desDir = File(folderPath)
|
||||
if (!desDir.exists()) {
|
||||
desDir.mkdirs()
|
||||
}
|
||||
val zf = ZipFile(zipFile)
|
||||
val entries: Enumeration<*> = zf.entries()
|
||||
while (entries.hasMoreElements()) {
|
||||
val entry = entries.nextElement() as ZipEntry
|
||||
if (entry.isDirectory) {
|
||||
continue
|
||||
}
|
||||
val `is` = zf.getInputStream(entry)
|
||||
var str = folderPath + File.separator + entry.name
|
||||
str = String(str.toByteArray(charset("8859_1")), charset("UTF-8"))
|
||||
val desFile = File(str)
|
||||
if (!desFile.exists()) {
|
||||
val fileParentDir = desFile.parentFile
|
||||
if (!fileParentDir!!.exists()) {
|
||||
fileParentDir.mkdirs()
|
||||
}
|
||||
desFile.createNewFile()
|
||||
}
|
||||
val os: OutputStream = FileOutputStream(desFile)
|
||||
val buffer = ByteArray(BUFFER_SIZE)
|
||||
var length: Int
|
||||
while ((`is`.read(buffer).also { length = it }) > 0) {
|
||||
os.write(buffer, 0, length)
|
||||
}
|
||||
os.flush()
|
||||
os.close()
|
||||
`is`.close()
|
||||
fileList.add(desFile)
|
||||
}
|
||||
return fileList
|
||||
}
|
||||
|
||||
|
||||
//复制文件
|
||||
@Throws(IOException::class)
|
||||
fun copyFile(sourceFile: File?, targetFile: File?) {
|
||||
|
@ -574,6 +464,7 @@ object FileUtils {
|
|||
}
|
||||
|
||||
fun writeAfLog() {
|
||||
LogUtils.d("FileUtils", "writeAfLog: ")
|
||||
val filePath = "/data/data/${recordPackageName}/log.txt"
|
||||
ShellUtil.execRootCmdAndGetResult("chmod 777 $filePath")
|
||||
val afLog = ShellUtil.execRootCmdAndGetResult("cat $filePath")
|
||||
|
@ -589,7 +480,7 @@ object FileUtils {
|
|||
return
|
||||
}
|
||||
}
|
||||
LogUtils.d("FileUtils", "afLog: $afLog", null)
|
||||
LogUtils.d("FileUtils", "afLog: $afLog")
|
||||
try {
|
||||
BufferedOutputStream(
|
||||
FileOutputStream(file)
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Handler
|
|||
import android.os.Looper
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import com.android.grape.BuildConfig
|
||||
import com.android.grape.MainApplication
|
||||
import com.android.grape.data.AppState
|
||||
import com.android.grape.data.AppState.afLog
|
||||
|
@ -177,7 +178,7 @@ object TaskUtils {
|
|||
// String params = "platform=Android&"TaskUtils"="+get"TaskUtils"(context)+"&uuid="+PrefUtil.getUUID(context);
|
||||
val ANDROID_ID =
|
||||
Settings.System.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
||||
val params = "platform=Android&tag=119&uuid=$ANDROID_ID"
|
||||
val params = "platform=Android&tag=${BuildConfig.TAG}&uuid=$ANDROID_ID"
|
||||
val valid = false
|
||||
println("IOSTQ:execReloginTask->url:$url?$params")
|
||||
try {
|
||||
|
@ -220,8 +221,7 @@ object TaskUtils {
|
|||
val url = "http://39.103.73.250/tt/ddj/preRequest!requestInstall.do"
|
||||
val ANDROID_ID =
|
||||
Settings.System.getString(context.contentResolver, Settings.System.ANDROID_ID)
|
||||
|
||||
val params = "platform=Android&tag=119&uuid=$ANDROID_ID"
|
||||
val params = "platform=Android&tag=${BuildConfig.TAG}&uuid=$ANDROID_ID"
|
||||
printStr("IOSTQ:request result : $url?$params")
|
||||
try {
|
||||
val result: String? = postData(
|
||||
|
|
Loading…
Reference in New Issue