android-writing-zippy-android-apps
手写Service后台下载app——跳出DownloadManager系统7.0之坑
手写Service后台下载app——跳出DownloadManager系统7.0之坑前言之前项目中有关app的现在和更新相关工具类一直用的是Android系统下载管理DownloadManager功能。
如果随着Android系统的不断提升再加上Android开源性手机厂家对此作恶部分改动。
导致一些系统自带的工具类出现异常情况。
华为P9华为P9/P9 Plus上线,你的APP准备好了吗?新机入手后,MTC率先从应用市场随机下载部分APP做基于P9/P9 Plus的兼容性测试,在Monkey脚本跑完之后,我们发现部分App会出现Crash、ANR的问题。
在此跟开发小伙伴们分享下产生此类问题的原因,开发小伙伴们在App开发过程中多加注意,避免此类问题的产生。
华为P9使用该华为P9在7.1的时候,利用系统DownloadManager工具类下载时就出现异常——在下载过程中竟突然自动消失!怀疑这个应该是Android系统和华为P9不兼容导致的一个的bug。
大家都知道,老板不懂代码,有时候出现的问题还不属于你的问题。
在其他手机上好使,部分手机就出现问题。
只要有一款手机出现一个问题就认为你的程序有问题。
这是最蛋疼的。
so,问题来了,谁让你是安卓程序员呢哈哈,抱怨是没有用的。
有问题还是要解决的。
1.首先是要判断是6.0权限/*** 请求运行时权限* eg:*/public void requestRuntimePermission(QuestPermissionListener questPermissionListener, String... permissions){BasePermisitionActivity.requestRuntimePermission(permissions,questPermissionListener);}.......6.0运行权限请参考:android6.0运行时权限完美封装下载service工具类:/*** 类功能描述:</br>* 自定义Service后台下载app——跳出DownloadManager系统下载之坑</br>* 修改人:yuyahao* @version 1.0 </p> 修改时间:</br> 修改备注:</br>*/public class UpdateService extends Service {public static final String TAG = "ServiceDownLoadApp";public static final String ACTION = "me.shenfan.UPDATE_APP";public static final String STATUS = "status";public static final String PROGRESS = "progress";public static boolean DEBUG = true;//下载大小通知频率public static final int UPDATE_NUMBER_SIZE = 1;public static final int DEFAULT_RES_ID = -1;public static final int UPDATE_PROGRESS_STA TUS = 0;public static final int UPDATE_ERROR_STATUS = -1;public static final int UPDATE_SUCCESS_STATUS = 1;//paramsprivate static final String URL = "downloadUrl";private static final String ICO_RES_ID = "icoResId";private static final String ICO_SMALL_RES_ID = "icoSmallResId";private static final String UPDATE_PROGRESS = "updateProgress";private static final String STORE_DIR = "storeDir";private static final String DOWNLOAD_NOTIFICATION_FLAG = "downloadNotificationFlag";private static final String DOWNLOAD_SUCCESS_NOTIFICATION_FLAG = "downloadSuccessNotificationFlag";private static final String DOWNLOAD_ERROR_NOTIFICATION_FLAG = "downloadErrorNotificationFlag";private static final String IS_SEND_BROADCAST = "isSendBroadcast";private String downloadUrl;private int icoResId; //default app icoprivate int icoSmallResId;private int updateProgress; //update notification progress when it add number private static String storeDir; //default sdcard/Android/package/update private int downloadNotificationFlag;private int downloadSuccessNotificationFlag;private int downloadErrorNotificationFlag;private boolean isSendBroadcast;private UpdateProgressListener updateProgressListener;private LocalBinder localBinder = new LocalBinder();/*** Class used for the client Binder.*/public class LocalBinder extends Binder{/*** set update progress call back* @param listener*/public void setUpdateProgressListener(UpdateProgressListener listener){ UpdateService.this.setUpdateProgressListener(listener);}}private boolean startDownload;//开始下载private int lastProgressNumber;private NotificationCompat.Builder builder;private NotificationManager manager;private int notifyId;private String appName;private LocalBroadcastManager localBroadcastManager;private Intent localIntent;private DownloadApk downloadApkTask;/*** whether debug*/public static void debug(){DEBUG = true;}/*** 点击通知栏去进行安装* @param path* @return*/private static Intent installIntent(String path){Uri uri = Uri.fromFile(new File(path));Intent installIntent = new Intent(Intent.ACTION_VIEW);installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);installIntent.setDataAndType(uri, "application/vnd.android.package-archive");return installIntent;}/*** 通过浏览器进行下载* @param downloadUrl* @return*/private static Intent webLauncher(String downloadUrl){Uri download = Uri.parse(downloadUrl);Intent intent = new Intent(Intent.ACTION_VIEW, download);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);return intent;}/*** 通过URL获取要下载的apk的前缀没弄过* @param downloadUrl* @return*/private static String getSaveFileName(String downloadUrl) {if (downloadUrl == null || TextUtils.isEmpty(downloadUrl)) {return "noName.apk";}return downloadUrl.substring(stIndexOf("/"));}/*** 来设置要下载apk储存的文件夹* @param service* @return*/private static File getDownloadDir(UpdateService service){File downloadDir = null;if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {if (service.storeDir != null){downloadDir = new File(Environment.getExternalStorageDirectory(), service.storeDir);}else {downloadDir = new File(service.getExternalCacheDir(), "update");}} else {downloadDir = new File(service.getCacheDir(), "update");}if (!downloadDir.exists()) {downloadDir.mkdirs();}return downloadDir;}@Overridepublic void onCreate() {super.onCreate();appName = getApplicationName();}@Overridepublic int onStartCommand(Intent intent, int flags, int startId) {if (!startDownload && intent != null){startDownload = true;downloadUrl = intent.getStringExtra(URL);icoResId = intent.getIntExtra(ICO_RES_ID, DEFAULT_RES_ID);icoSmallResId = intent.getIntExtra(ICO_SMALL_RES_ID, DEFAULT_RES_ID);storeDir = intent.getStringExtra(STORE_DIR);updateProgress = intent.getIntExtra(UPDATE_PROGRESS, UPDATE_NUMBER_SIZE);downloadNotificationFlag = intent.getIntExtra(DOWNLOAD_NOTIFICATION_FLAG, 0);downloadErrorNotificationFlag = intent.getIntExtra(DOWNLOAD_ERROR_NOTIFICATION_FLAG, 0);downloadSuccessNotificationFlag = intent.getIntExtra(DOWNLOAD_SUCCESS_NOTIFICATION_FLAG, 0);isSendBroadcast = intent.getBooleanExtra(IS_SEND_BROADCAST, false);if (DEBUG){LogUtil.e(TAG, "downloadUrl: " + downloadUrl);LogUtil.e(TAG, "icoResId: " + icoResId);LogUtil.e(TAG, "icoSmallResId: " + icoSmallResId);LogUtil.e(TAG, "storeDir: " + storeDir);LogUtil.e(TAG, "updateProgress: " + updateProgress);LogUtil.e(TAG, "downloadNotificationFlag: " + downloadNotificationFlag);LogUtil.e(TAG, "downloadErrorNotificationFlag: " + downloadErrorNotificationFlag);LogUtil.e(TAG, "downloadSuccessNotificationFlag: " + downloadSuccessNotificationFlag);LogUtil.e(TAG, "isSendBroadcast: " + isSendBroadcast);}notifyId = startId;buildNotification();buildBroadcast();downloadApkTask = new DownloadApk(this);downloadApkTask.execute(downloadUrl);}return super.onStartCommand(intent, flags, startId);}@Nullable@Overridepublic IBinder onBind(Intent intent) {return localBinder;}@Overridepublic boolean onUnbind(Intent intent) {return true;}public void setUpdateProgressListener(UpdateProgressListener updateProgressListener) { this.updateProgressListener = updateProgressListener;}@Overridepublic void onDestroy() {if (downloadApkTask != null){downloadApkTask.cancel(true);}if (updateProgressListener != null){updateProgressListener = null;}localIntent = null;builder = null;super.onDestroy();}/*** 获取当前的应用名* @return*/public String getApplicationName() {PackageManager packageManager = null;ApplicationInfo applicationInfo = null;try {packageManager = getApplicationContext().getPackageManager();applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);} catch (NotFoundException e) {applicationInfo = null;}String applicationName =(String) packageManager.getApplicationLabel(applicationInfo);return applicationName;}private void buildBroadcast(){if (!isSendBroadcast){return;}localBroadcastManager = LocalBroadcastManager.getInstance(this);localIntent = new Intent(ACTION);}/*** 发送广播* @param status* @param progress*/private void sendLocalBroadcast(int status, int progress){if (!isSendBroadcast || localIntent == null){return;}localIntent.putExtra(STA TUS, status);localIntent.putExtra(PROGRESS, progress);localBroadcastManager.sendBroadcast(localIntent);}/*** 环形通知安*/private void buildNotification(){manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);builder = new NotificationCompat.Builder(this);builder.setContentTitle(getString(R.string.update_app_model_prepare, appName)).setWhen(System.currentTimeMillis()).setProgress(100, 1, false).setSmallIcon(icoSmallResId).setLargeIcon(BitmapFactory.decodeResource(getResources(), icoResId)).setDefaults(downloadNotificationFlag);manager.notify(notifyId, builder.build());}/*** 开始下载*/private void start(){builder.setContentTitle(appName);builder.setContentText(getString(R.string.update_app_model_prepare, 1));manager.notify(notifyId, builder.build());sendLocalBroadcast(UPDATE_PROGRESS_STATUS, 1);if (updateProgressListener != null){updateProgressListener.start();}}/**** 通知进度条,进度条* 大小范围(1~100)*/private void update(int progress){if (progress - lastProgressNumber > updateProgress){lastProgressNumber = rogress;builder.setProgress(100, progress, false);builder.setContentText(getString(R.string.update_app_model_progress, progress, "%"));manager.notify(notifyId, builder.build());sendLocalBroadcast(UPDATE_PROGRESS_STA TUS, progress);if (updateProgressListener != null){updateProgressListener.update(progress);}}}/*** 下载成功的回调* @param path*/private void success(String path) {builder.setProgress(0, 0, false);builder.setContentText(getString(R.string.update_app_model_success));eString(this,"asdfasdf");manager.cancel(0);if(FileHelper.checkFileIsExists(path)){Intent i = installIntent(path);PendingIntent intent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDA TE_CURRENT);builder.setContentIntent(intent).setAutoCancel(true)//用户点击就自动消失.setDefaults(downloadSuccessNotificationFlag);Notification n = builder.build();n.contentIntent = intent;manager.notify(notifyId, n);if (updateProgressListener != null){updateProgressListener.success();}startActivity(i);IntentFilter filter = new IntentFilter();}else{DataCleanManager.deleteFilesByDirectory2(storeDir);}stopSelf();}/*** 清除本地文件*/public static void deleteFilesByDirectory(){DataCleanManager.deleteFilesByDirectory2(storeDir);}/*** 下载失败通知浏览器下载回调*/private void error(){Intent i = webLauncher(downloadUrl);PendingIntent intent = PendingIntent.getActivity(this, 0, i,PendingIntent.FLAG_UPDATE_CURRENT);builder.setContentText(getString(R.string.update_app_model_error));builder.setContentIntent(intent);builder.setProgress(0, 0, false);builder.setDefaults(downloadErrorNotificationFlag);Notification n = builder.build();n.contentIntent = intent;manager.notify(notifyId, n);sendLocalBroadcast(UPDATE_ERROR_STA TUS, -1);if (updateProgressListener != null){updateProgressListener.error();}stopSelf();}/*** 下载异步任务*/private static class DownloadApk extends AsyncTask<String, Integer, String>{ private WeakReference<UpdateService> updateServiceWeakReference;public DownloadApk(UpdateService service){updateServiceWeakReference = new WeakReference<>(service);}@Overrideprotected void onPreExecute() {super.onPreExecute();UpdateService service = updateServiceWeakReference.get();if (service != null){service.start();}}@Overrideprotected String doInBackground(String... params) {//注意,这里现在之前先进行清空文件,防止因检查到已经有存在的文件而无法进行下载DataCleanManager.deleteFilesByDirectory2(""+UpdateService.getDownloadDir(updateServiceWeakReference.get()) .getAbsolutePath());final String downloadUrl = params[0];final File file = new File(UpdateService.getDownloadDir(updateServiceWeakReference.get()),UpdateService.getSaveFileName(downloadUrl));if (DEBUG){LogUtil.e(TAG, "download url is " + downloadUrl);LogUtil.e(TAG, "download apk cache at " + file.getAbsolutePath());}File dir = file.getParentFile();if (!dir.exists()){dir.mkdirs();}HttpURLConnection httpConnection = null;InputStream is = null;FileOutputStream fos = null;int updateTotalSize = 0;URL url;try {url = new URL(downloadUrl);httpConnection = (HttpURLConnection) url.openConnection();httpConnection.setConnectTimeout(5000);httpConnection.setReadTimeout(5000);if (DEBUG){LogUtil.e(TAG, "download status code: " + httpConnection.getResponseCode());}if (httpConnection.getResponseCode() != 200) {return null;}updateTotalSize = httpConnection.getContentLength();if (file.exists()) {if (updateTotalSize == file.length()) {// 下载完成return file.getAbsolutePath();} else {file.delete();}file.createNewFile();is = httpConnection.getInputStream();fos = new FileOutputStream(file, false);byte buffer[] = new byte[4096];int readSize = 0;int currentSize = 0;while ((readSize = is.read(buffer)) > 0) {fos.write(buffer, 0, readSize);currentSize += readSize;publishProgress((currentSize * 100 / updateTotalSize));}// download success} catch (Exception e) {e.printStackTrace();return null;} finally {if (httpConnection != null) {httpConnection.disconnect();}if (is != null) {try {is.close();} catch (IOException e) {e.printStackTrace();}}if (fos != null) {try {fos.close();} catch (IOException e) {e.printStackTrace();}}}return file.getAbsolutePath();}@Overrideprotected void onProgressUpdate(Integer... values) {super.onProgressUpdate(values);LogUtil.e(TAG, "current progress is " + values[0]);}UpdateService service = updateServiceWeakReference.get();if (service != null){service.update(values[0]);}}@Overrideprotected void onPostExecute(String s) {super.onPostExecute(s);UpdateService service = updateServiceWeakReference.get();if (service != null){if (s != null){service.success(s);}else {service.error();}}}}/*** a builder class helper use UpdateService* 仿AlertDialogUpdateService的构造器*/public static class Builder{private String downloadUrl;private int icoResId = DEFAULT_RES_ID; //default app icoprivate int icoSmallResId = DEFAULT_RES_ID;private int updateProgress = UPDATE_NUMBER_SIZE; //update notification progress when it add numberprivate String storeDir; //default sdcard/Android/package/updateprivate int downloadNotificationFlag;private int downloadSuccessNotificationFlag;private int downloadErrorNotificationFlag;private boolean isSendBroadcast;protected Builder(String downloadUrl){this.downloadUrl = downloadUrl;}public static Builder create(String downloadUrl){if (downloadUrl == null) {throw new NullPointerException("downloadUrl == null");}return new Builder(downloadUrl);}public String getDownloadUrl() {return downloadUrl;}public int getIcoResId() {return icoResId;}public Builder setIcoResId(int icoResId) {this.icoResId = icoResId;return this;}public int getIcoSmallResId() {return icoSmallResId;}public Builder setIcoSmallResId(int icoSmallResId) {this.icoSmallResId = icoSmallResId;return this;}public int getUpdateProgress() {return updateProgress;}public Builder setUpdateProgress(int updateProgress) {if (updateProgress < 1){throw new IllegalArgumentException("updateProgress < 1");}this.updateProgress = updateProgress;return this;}public String getStoreDir() {return storeDir;}public Builder setStoreDir(String storeDir) {this.storeDir = storeDir;return this;}public int getDownloadNotificationFlag() {return downloadNotificationFlag;}public Builder setDownloadNotificationFlag(int downloadNotificationFlag) {this.downloadNotificationFlag = downloadNotificationFlag;return this;}public int getDownloadSuccessNotificationFlag() {return downloadSuccessNotificationFlag;}public Builder setDownloadSuccessNotificationFlag(int downloadSuccessNotificationFlag) {this.downloadSuccessNotificationFlag = downloadSuccessNotificationFlag;return this;}public int getDownloadErrorNotificationFlag() {return downloadErrorNotificationFlag;}public Builder setDownloadErrorNotificationFlag(int downloadErrorNotificationFlag) { this.downloadErrorNotificationFlag = downloadErrorNotificationFlag;return this;}public boolean isSendBroadcast() {return isSendBroadcast;}public Builder setIsSendBroadcast(boolean isSendBroadcast) {this.isSendBroadcast = isSendBroadcast;return this;}public Builder build(Context context){if (context == null){throw new NullPointerException("context == null");}Intent intent = new Intent();intent.setClass(context, UpdateService.class);intent.putExtra(URL, downloadUrl);if (icoResId == DEFAULT_RES_ID){icoResId = getIcon(context);}if (icoSmallResId == DEFAULT_RES_ID){icoSmallResId = icoResId;}intent.putExtra(ICO_RES_ID, icoResId);intent.putExtra(STORE_DIR, storeDir);intent.putExtra(ICO_SMALL_RES_ID, icoSmallResId);intent.putExtra(UPDA TE_PROGRESS, updateProgress);intent.putExtra(DOWNLOAD_NOTIFICATION_FLAG, downloadNotificationFlag);intent.putExtra(DOWNLOAD_SUCCESS_NOTIFICATION_FLAG, downloadSuccessNotificationFlag);intent.putExtra(DOWNLOAD_ERROR_NOTIFICATION_FLAG, downloadErrorNotificationFlag);intent.putExtra(IS_SEND_BROADCAST, isSendBroadcast);context.startService(intent);return this;}/*** 得到系当前应用的相对应的图标* @param context* @return*/private int getIcon(Context context){final PackageManager packageManager = context.getPackageManager();ApplicationInfo appInfo = null;try {appInfo = packageManager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DA TA);} catch (NotFoundException e) {e.printStackTrace();}if (appInfo != null){return appInfo.icon;}return 0;}}}注意这里的LocalBroadcastManagerLocalBroadcastManager基本介绍这个类是在v4包中的,谷歌官方的介绍是:Helper to register for and send broadcasts of Intents to local objects within your process. This is has a number of advantages over sending global broadcasts with sendBroadcast(Intent):You know that the data you are broadcasting won’t leave your app, so don’t need to worry about leaking private data. It is not possible for other applications to send these broadcasts to your app, so you don’t need to worry about having security hol es they can exploit. It is more efficient than sending a global dcast through the system.大致意思是:帮助程序注册和发送Intents的广播到您的进程中的本地对象。
Android反编译和编译
【Android 教程】反编译和编译第一:要在你的PC上建立Java的环境,才能执行编译工作。
具体方法我这个就不说了,你百度或者Google下就知道了,很简单的。
第二:下载必要的工具。
Apktool工具,下载地址/file/e65esebm下载后解压(有三个文件aapt.exe,apktool.bat,apktool.jar),为了方便。
将解压出来的文件放在CDM模式(win+R)默认的目录下。
比如,我的是Windows7 32位我的CDM模式默认目录是C:\USER\用户名。
第三:如果你是要编译系统文件的话,请将你要修改的rom里的framework-res.apk和com.htc.resources.apk(暂时叫做依赖包)用CMD模式“安装”下。
这样编译才不会出错。
我一开始就是在这里纠结了很久。
呵呵安装方法:把依赖包放在刚才放apktool的目录下。
(你也可以用指定目录的方法安装)cmd模式执行apktool if framework-res.ap k这个是安装framework-res.apkapktool if com.htc.resources.apk 这个是安装com.htc.resources.ap k第四:准备工作都做好了,现在就可以反编译和编译了。
将你要反编译的ap k放在ap ktool的目录下。
(你也可以用指定目录)cmd模式执行apktool d **X.ap k 这个是Decode也就是反编译比如反编译rosie 就执行ap ktool d rosie.ap k 就可以了(会在当前的目录下生成rosie的文件夹,修改就是在这个文件夹里进行)cmd模式执行apktool b **X 这个是build 也就是编译回去比如编译rosie 就执行ap ktool b rosie 就可以了(会在rosie的文件夹中生成一个叫dist 的文件夹,编译回去的ap k就是此文件夹中)另外说明:反编译和编译也可以用第三方工具而不用命令行。
Android手机端使用Zipalign优化apk应用程序
Android手机端使用Zipalign优化apk应用程序作者:deng0525 2012-06-11 10:10 点击:10765来源: ( 0条评论)据android官方网站的说明zipalign是一款重要的优化apk应用程序的工具。
apk包的本质是一个zip压缩文档,优化的目的是使包内未压缩的数据能够有序的排列,从而减少应用程序运行时的内存消耗。
多数软件开发商在正式推出其android应用程序,都使用zipalign工具优化apk包。
但是,仍然有一些应用程序需要我们自己动手进行zipalign优化,例如一些个人开发的软件,一些破解版的软件。
在这里我主要介绍使用adb 直接进行apk优化以及在已经Root的Android手机端进行apk优化这两种方法。
正式开始时请下载二进制文件和脚本代码:zipalign.zip,解压后产生一个二进制文件zipalign,一个可执行脚本zipalign_apks。
点击下载方法一:adb法(需要电脑已装有android sdk)1)安装代码adb shell mount -o remount,rw /systemadb push zipalign /system/binadb push zipalign_apks /system/sd/zipalign_apks.shadb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.shadb shell mount -o remount,ro /system2)运行脚本代码adb shell sh /system/sd/zipalign_apks.sh或者在手机超级终端运行sush /system/sd/zipalign_apks.sh方法二:使用Root ExplorerRoot Explorer(简称RE)是一款强大的root管理器,它可以对系统区进行读写操作。
安卓系统刷机界面英文翻译大全,刷机必备!
安卓系统刷机界面英文翻译大全,刷机必备!-reboot system now 重启系统-apply update f rom ADB 从ADB进行更新。
ADB驱动是Android设备(如手机)连接PC时所需要的应用程序。
-apply updata from internal sdcard 使用手机内存中的刷机包-apply updata from external sdcard 使用手机扩展SD卡中的刷机包-apply sdcard:update.zip 使用SD卡根目录的update.zip更新系统-wipe data/factory reset 清空data分区并恢复出厂设置-wipe cache partition 清空cache(高速缓存)分区-install zip from sdcard 从SD卡选择文件更新系统--apply sdcard:update.zip 使用SD卡根目录的update.zip 更新系统--choose zip from sdcard 从SD卡选择zip格式升级包--toggle signature verification 切换签名验证--toggle script asserts 切换升级脚本检查-backup and restore 备份和恢复--Backup 备份--Restore 恢复--Advanced Restore 高级恢复-mounts and storage 挂载和存储--mount /system 挂载/system分区(系统分区)--mount /data 挂载/data分区(数据分区)--mount /cache 挂载/cache分区(缓存分区)--mount /sd-ext 挂载/sd-ext分区(A2SD分区)--format boot 格式化内核分区--format system 格式化系统分区--format data 格式化数据分区--format cache 格式化缓存分区--format sdcard 格式化存储卡--format sd-ext 格式化内存卡SD--mount USB storage 挂载SD卡为U盘模式-advanced 高级--Reboot Recovery 重启Recovery--Wipe Dalvik Cache 清空Dalvik缓存--Wipe Battery Stats 清空电池状态--Report Error 报告错误--Key Test 键位测试--Partition SD Card 对SD卡分区--Fix Permissions 修复权限。
拍照修改英文作文的app
拍照修改英文作文的app1. This app is a game-changer when it comes to editing your photos. It's like having a personal stylist right at your fingertips. You can easily enhance your pictures with just a few taps and swipes, making them look professional and eye-catching. Trust me, your Instagram feed will never be the same again.2. The best part about this app is its simplicity. You don't need to be a tech genius to use it. The user interface is so intuitive that even your grandma could figure it out. Just choose a photo, select the editing tools you want to use, and voila! Your picture is transformed into a work of art.3. What sets this app apart from others is its wide range of editing options. You can adjust the brightness, contrast, and saturation of your photos to make them pop. There are also various filters and effects to choose from, allowing you to create different moods and styles. Whetheryou want a vintage look or a modern vibe, this app has got you covered.4. Another cool feature of this app is its ability to remove blemishes and imperfections from your photos. Say goodbye to those pesky pimples and dark circles. With just a few taps, your skin will look flawless and radiant. You can even whiten your teeth and smooth out wrinkles. It's like having a virtual beauty salon in your pocket.5. But wait, there's more! This app also offers advanced editing tools for those who want to take their photos to the next level. You can play around with the exposure, shadows, and highlights to create stunning effects. There's even a feature that allows you to selectively adjust certain areas of your photo, so you can make specific elements stand out.6. And let's not forget about the fun stuff. This app lets you add stickers, text, and doodles to your photos. You can unleash your creativity and personalize your pictures with funny captions or cute illustrations. It's agreat way to add a personal touch and make your photostruly unique.7. Once you're done editing, you can easily share your masterpiece with the world. This app allows you toinstantly upload your photos to social media platforms like Instagram, Facebook, and Twitter. You can also save them to your camera roll or send them to your friends via messaging apps. It's never been easier to show off your photography skills.8. In conclusion, this app is a game-changer for anyone who loves taking and editing photos. It's user-friendly, versatile, and packed with features that will make your pictures look amazing. So why wait? Download it now and start unleashing your inner photographer. Your Instagram followers will thank you.。
Android.mk之编译生成可执行文件
Android.mk之编译⽣成可执⾏⽂件Android.mk之编译⽣成可执⾏⽂件
⼀、简介
对于学过Linux内核的来说,想要去编译⼀个⽂件,⽣成可执⾏⽂件也好,打包成库也罢,都是使⽤Makefile 来管理编译的。
那么对于Android底层开发来讲,也是需要把咱们写的代码,编译成可执⾏⽂件或者其他可⽤的⽂件,才能使⽤起来。
再Android对这些⽂件的管理当然也需要⼀个东西来管理,其名字叫Android.mk。
⼆、Android.mk
Android系统整⼀个编译程序链接的环境很庞⼤,咱们要把Android.mk的所有东西都认识会有点⿇烦。
这⾥主要介绍如何去使⽤Android.mk去把⽂件编译成:
1、可执⾏⽂件
2、动态库
3、静态库
当然还有Jar包和APK了,这两个暂时在这⾥不讨论。
三、Android.mk编译成可执⾏⽂件的⽅法
3.1、下⾯为Android.mk
LOCAL_PATH := $(call my-dir) //定义当前模块的相对路径
include $(CLEAR_VARS) //清除当前的环境变量
LOCAL_MODULE := test //编译⽣成的⽬标名
LOCAL_SRC_FILES := test.c //编译该模块需要的源⽂件
LOCAL_MODULE_PATH += $(LOCAL_PATH) //⽣成⽂件的位置
include $(BUILD_EXECUTABLE) //编译⽣成的⽂件格式
其中“my-dir”是由编译系统提供的宏函数,⽤于返回当前Android.mk所在的路径。
下⾯来看⼀个编译多个⽂件的例⼦:。
android自定义ZIP刷机包攻略
自定义ZIP刷机包攻略猫版的话:今天发现某论坛有人剽窃了本文,而没有注明出处。
对此,猫版表示非常愤慨。
大家转载本文可以,但是请注明出处。
如题,CM更新这么频繁,真没办法每天跟着他们折腾了。
所以把自定义ZIP刷机包的方法告诉大家,有兴趣的朋友自己弄吧。
提示:虽然风险不大,但是如果由此产生任何问题,本人不负责解答和承担相关责任。
首先,解压开ZIP包。
应该得到2个文件夹和一个img文件。
1.如何替换ROM包里的软件?(比如launcher等)其实很简单!删掉system\app里的相应的apk,加入自己的apk即可,而且不需要同名称。
比如CM原来集成了ADWlauncher,直接删掉它,把我们想要的launcher放进去就行。
2.如何修改版本号?依旧非常简单!嘿嘿~用记事本打开build.prop,修改以下几行就行(如果装有linux的话,在linux下修改更好,windows下排版显示错误,包含中文的话需要UTF-8格式保存)另外,给一点常用的配置参数,加在最后就可以了:nguage=zhro.product.locale.region=CNro.setupwizard.mode=DISABLEDpersist.sys.timezone=Asia/Shanghai3.如何修改默认壁纸?如何加入菜单弹跳效果?好吧,猫猫表示依旧非常简单~①默认壁纸:用winrar直接打开system\framework里的framework-res.apk。
注意:是用winrar直接打开,而非解压!进入res\drawable.直接替换default_wallpaper.jpg即可!(建议使用640X480分辨率的图片)②弹跳菜单进入res\anim,用附件“blur.zip”里的文件直接替换相应文件即可。
再次提醒:以上两个操作必须在rar中直接操作,否则会损坏签名,无法启动。
4.如何替换开机动画?哈哈,更简单!直接用2.1可用的动画包替换system\media下的动画包即可(文件名必须是bootanimation.zip~)5.如何汉化运营商名称?猫猫还要说一句说了多次的话:很简单!用记事本打开system\etc下的spn-conf.xml。
安卓手机各APP对应含义
MiuiCompass.apk 指南针
MiuiSuperMarket.apk 商店,不能删,开机过程中在MI标志那里卡住的(耗电耗内存,如果不需要可冻结)
MiuiVideo.apk 视频,建议冻结,在拍录像后想马上回放的就需要它.如果你不需要也可以删除
MTKAndroidSuiteDaemon.apk-联发科这个牌子硬件作的手机配套的安卓套件精灵,方便在电脑直接访问手机内存卡,如果用其他手机助手的可以删除
SystemAdSolution.apk 系统广告推送服务
ThemeManager.apk 个性化主题,平时不用就把它冻结隔离,换主题桌面铃声的时候需要它的
TrafficControl.apk 流量节省(耗电耗内存,强烈建议删除,实测没有什么卵用)
Updater.apk 系统升级,可冻结隔离不能删除,开机过程中在MI标志那里卡住的(耗电耗内存,如果不需要可冻结)
VpnDialogs.apk VPN,可删除
Weather.apk 天气(耗电耗内存,强烈建议删除,你要看天气,不会打开浏览器啊)
WeatherProvider.apk 天气功能相配套的服务,删除.
YellowPage.apk 黄页,删除后拨号切换到黄页会FC(耗电耗内存,建议删除,影响不大)
jjstore.apk小米极简模式里面的商店之类的东西
KingSoftCleaner.apk 就是小米系统里的安全中心里的垃圾清理功能(如果使用第三方类似功能软件就可以删除)
LiveWallpapers.apk 动态壁纸
LiveWallpapersPicker.apk 动态壁纸配套程序
MtkFloatMenu.apk联发科浮动菜单
android打包英文中文版
前段时间做了一个android的网游项目,现在优化减少体积和防止别人反编译,需要把编译后.class进行混淆,开始在网上看了一些关于ProGuard的介绍,基本上都是使用ADT 自带的打包方式,那个打包方式太慢了,还要手工输密码,一个字烦。
于是开始寻找ant+proguard+签名的打包方式,遗憾的是资料不是缺手就是断脚。
好吧,看来得食自己了,!@#¥@#!@#!@##¥@#¥!@#@ 转眼一周,我++,终于把东西搞出来ps:我们项目还有一个特殊需求,要把版本号,推广ID打到包里去,方便做推广什么的。
这里可以用replace的方法对string.xml进行修改好吧,废话不说了,直接上build文件<?XML 版本= “1.0”编码= “UTF-8”?>00 2 < 项目名称= “xiyou_base_”默认= “deployableAllDevice” >00 3<! - proguard4的路径 - >00 4 < 属性名称= “proguard.home”的“D :/ software/j2me/proguard4.5.1/proguard4.5.1” />00 5<! - SDK的路径- >00 6 < 属性名称= “sdk.dir” = “C:\ dev的\ Android的SDK窗口” />00 7< - 是否使用签名- >00 8 < 属性名称= “has.keystore的”值= “真” />00 9<! - 签名密码- >01 0 < 属性名称= “has.password”值= “真” />01 1< - !签名相关的关键- >01 2 < 属性名称= “key.alias”值=的“key.keystore” />01 3 < 属性名称= “key.store”值=的“key.keystore” />01 4< - !签名相关密码- >01 5 < 属性名称= “key.store.password” = “XXXX” />01 6 < 属性名称= “key.alias.password” = “XXXX” />01 7 01 801 9<!-02 0 default.properties 内容02 1目标=机器人-402 2proguard.config = proguard.cfg023 - >02 4 < 属性文件“的default.properties:” />02 502 6<! - 定制的Android任务处理项目的目标,并导入02 7适当的规则。
ShareSDK Android常见问题汇总
Q:依照集成文档说明,配置AndroidManifest.xml后,提示<uses-permission android:name="android.permission.WRITE_APN_SETTINGS" /》有错A:这个是ADT Lint工具的问题,请依照下面的路径“菜单-- 窗口-- 首选项-- android -- lint error checking”打开lint的配置页面,然后去掉页面顶部的两个勾选,之后再clean 项目就能处理Q:已经增加了onekeyshare.jar,编译没有提示错误,但运行时提示找不到类WeiboGridViewA:请确保您的编译sdk版本为android2.2以上,并在您项目的libs下添加android.suport 的包,这个包是android sdk自己提供的,因此share sdk并未提供此包Q:为什么我使用Demo中人人网的AppId和ApiKey以后,无法授权和获取资料Demo中的开发者帐号是测试帐号,仅用于集成演示,按照人人网的规定,如果您的帐号要使用这个ApiKey进行调试,需要在我们的开发者信息中注册你的帐号信息,因为你的帐号我们是不知道的,因此我们没有将你的帐号注册到我们的测试帐号列表里面,因此你无法使用Demo授权你的帐号并获取资料。
我们并不建议开发者直接使用我们放在ShareSDKDevInfor.xml中的开发者信息,因为这些Demo这个应用的演示信息,它随时可能失效,而且将来集成到你的应用中,也无法在分享的内容中标记你的应用。
Q:如何使用微信的签名A:1、你要有一个keystore,可以自己生成一个,要一个之类的2、利用这个keystore给你应用签名3、下载微信那个东西,安装4、安装你已经签名的应用到手机5、启动微信的工具,输入你应用的包名6、微信的工具会帮你计算一个hash值7、将这个hask值放到你注册android应用时的“应用签名”8、注册成功后,你的包名和keystore从此捆绑9、以后调试,都需要签名,否则无法调用微信客户端Q:软件第三方登入的流程是什么样的啊?A: 1、你们需要支持用户注册2、你们需要在应用登录的时候提供第三方平台的图标3、用户点击第三方平台图标以后,你们尝试判断用户是否已经授权4、如果用户授权,获取他的唯一识别符,比方说WeiboDb里面的weiboId这个字段5、如果用户没有授权,引导用户授权,授权成功后也可以获取weibo Id6、然后用这个唯一识别符登录你们的系统,如果用户已经注册,则应该让用户登录到你们的系统,流程结束7、如果你们的系统发现用户没有注册,引导用户进入你们应用的注册页面,并通过share sdk的showuser方法获取用户资料,自动帮助用户完成注册资料的填写,然后等待用户确认8、如果用户确认了注册信息,你们的应用就根据他的信息完成这注册操作,如果操作成功,则应该让用户登录到你们的系统,流程结束ShareSDK官方下载:/download。
安卓文件夹名称含义中英文对照
安卓文件夹名称含义(中英文对照)1。
android_secure 是官方app2sd的产物,存储了相关的软件使用认证验证,删了之后装到sd卡中的软件就无法使用了,小心别误删。
2。
Bluetooth 用蓝牙之后就会有这个。
3。
.mobo Moboplayer的缓存文件.4. 。
QQ QQ的缓存文件,定期清除。
5。
quickoffice 顾名思义,quickoffice的缓存文件.6。
switchpro 顾名思义,switchprowidget(多键开关)的缓存文件。
7. 。
ucdlres UC迅雷的缓存文件.8. albumart 音乐专辑封面的缓存文件夹。
9。
albums 相册缩略图的缓存文件夹.10。
Android 比较重要的文件夹,里面是一些程序数据,比如google map 的地图缓存,误删掉后地图还需重新下载。
11. backups 一些备份文件,比如联系人导出到SD卡时会导入到此文件夹。
12。
baidu 顾名思义,掌上百度、百度输入法之类程序的缓存文件夹。
13. bugtogo 系统出现问题的时候会形成一些报告文件,存放于此文件夹。
14. cmp 个人判断是音乐的缓存文件夹。
15。
data 同样是缓存数据的文件夹,与Android性质类似。
“截图助手"截图保存在data\com。
edwardkim。
android.screenshotitfull\screenshots 里.16. DCIM 相机的随机缓存文件夹,一些功能设置参数的记录,及时整理清除。
一些第三方的相机软件拍出的相片会保存在这里比如360或晕影相机删除时仔细看清楚。
17。
documents Documents To Go 的相关文件夹.18. etouch 易行的缓存文件夹。
19。
extracted androzip等解压缩软件默认的解压目录。
20。
gameloft gameloft游戏数据包存放的文件夹。
21. handcent 顾名思义handcent(超级短信)数据文件夹.22。
在centos中使用zipalign
在centos中使用zipalignzipalign是一个用于优化Android应用程序的工具,它可以对APK文件进行对齐操作,从而提高应用程序的性能和效率。
在CentOS操作系统中,我们可以通过以下步骤来使用zipalign工具。
第一步,安装zipalign工具。
在CentOS中,我们可以使用以下命令来安装zipalign:```sudo yum install android-tools```这个命令会安装Android SDK中的工具包,其中包括zipalign工具。
第二步,找到要优化的APK文件。
在CentOS中,我们可以使用以下命令来查找APK文件:```find /path/to/apk/files -name "*.apk"```将“/path/to/apk/files”替换为你存放APK文件的路径。
第三步,使用zipalign工具对APK文件进行对齐操作。
在CentOS 中,我们可以使用以下命令来对APK文件进行对齐操作:```zipalign -v 4 /path/to/input.apk /path/to/output.apk```将“/path/to/input.apk”替换为要优化的APK文件的路径,将“/path/to/output.apk”替换为优化后的APK文件的路径。
在这个命令中,“-v”参数表示输出详细信息,“4”参数表示对齐的字节大小,默认为4字节。
第四步,验证优化后的APK文件。
在CentOS中,我们可以使用以下命令来验证优化后的APK文件是否已经对齐:```zipalign -c -v 4 /path/to/output.apk```将“/path/to/output.apk”替换为优化后的APK文件的路径。
在这个命令中,“-c”参数表示检查APK文件是否已经对齐。
通过以上步骤,我们就可以在CentOS中使用zipalign工具对APK 文件进行对齐操作了。
zipalign align 范围
zipalign align 范围Zipalign是Android开发工具包(Android SDK)中的一个工具,用于对Android应用程序的APK文件进行优化。
它的作用是对齐APK文件中的资源和数据,以提高应用程序的性能和效率。
在Android应用程序的开发过程中,开发人员将应用程序打包成APK文件,并将其安装到Android设备上。
然而,由于APK文件的结构,其中包含了许多资源和数据,这些资源和数据可能会导致设备在读取和加载应用程序时的效率问题。
Zipalign工具的作用就是解决这个问题。
它通过重新排列APK文件中的资源和数据,使其对齐到内存边界,从而减少读取和加载时的开销。
具体来说,Zipalign工具会检查APK文件中的每个文件的对齐情况,并将其对齐到4字节的边界,以确保在读取和加载时能够以最小的内存开销进行操作。
通过使用Zipalign工具,开发人员可以显著提高应用程序的性能和效率。
对齐后的APK文件可以更快地加载和执行,从而提供更好的用户体验。
此外,由于对齐后的APK文件减少了不必要的内存开销,因此还可以节省设备的电池寿命和存储空间。
Zipalign工具的使用非常简单。
开发人员只需要在命令行中执行以下命令:```zipalign -v 4 input.apk output.apk```其中,`input.apk`是要优化的APK文件的路径,`output.apk`是优化后的APK文件的路径。
`-v`参数用于显示命令的详细输出信息,`4`参数表示对齐到4字节的边界。
需要注意的是,Zipalign工具只能用于已签名的APK文件。
在对APK文件进行优化之前,开发人员需要使用Android签名工具(apksigner或jarsigner)对APK文件进行签名。
除了手动使用命令行工具之外,开发人员还可以通过使用Android 开发工具包(Android SDK)提供的集成开发环境(IDE)来自动执行Zipalign工具。
Android学习笔记之反编译工具介绍及下载(An-Better工作室)
Android学习笔记之反编译工具介绍及下载(Class文件反编译,xml文件反编译整理)
最近在网上查了一些Android文件反编译工具,供大家参考。
1.CLASS文件反编译工具:XJAD
2.xml文件工具AXMLPrinter2.jar
将它放到android-sdk-windows-1.5_r3\tools文件夹中
运行cm d,进入tools目录,运行java -jar AXMLPrinter2.jar main.xml > main.txt
这时我们会看到生成一个m ain.tx t文件,就是反编译后的
3.dex文件反编译dex2jar.bat
1.首先找到Android软件安装包中的class.dex
把apk文件改名为.zip,然后解压缩其中的class.dex文件,它就是java文件编译再通过dx工具打包成的,所以现在我们就用上述提到的2个工具来逆方向导出java源文件;
2.把class.dex拷贝到dex2jar.bat所在目录。
运行dex2jar.bat classes.dex,生成classes.dex.dex2jar.jar
这时你将看到生成的jar包,然后通过上述的XJAD反编译class文件。
Android实现zip文件压缩及解压缩的方法
Android实现zip⽂件压缩及解压缩的⽅法本⽂实例讲述了Android实现zip⽂件压缩及解压缩的⽅法。
分享给⼤家供⼤家参考。
具体如下:DirTraversal.java如下:package com.once;import java.io.File;import java.util.ArrayList;import java.util.LinkedList;/*** ⽂件夹遍历* @author once**/public class DirTraversal {//no recursionpublic static LinkedList<File> listLinkedFiles(String strPath) {LinkedList<File> list = new LinkedList<File>();File dir = new File(strPath);File file[] = dir.listFiles();for (int i = 0; i < file.length; i++) {if (file[i].isDirectory())list.add(file[i]);elseSystem.out.println(file[i].getAbsolutePath());}File tmp;while (!list.isEmpty()) {tmp = (File) list.removeFirst();if (tmp.isDirectory()) {file = tmp.listFiles();if (file == null)continue;for (int i = 0; i < file.length; i++) {if (file[i].isDirectory())list.add(file[i]);elseSystem.out.println(file[i].getAbsolutePath());}} else {System.out.println(tmp.getAbsolutePath());}}return list;}//recursionpublic static ArrayList<File> listFiles(String strPath) {return refreshFileList(strPath);}public static ArrayList<File> refreshFileList(String strPath) {ArrayList<File> filelist = new ArrayList<File>();File dir = new File(strPath);File[] files = dir.listFiles();if (files == null)return null;for (int i = 0; i < files.length; i++) {if (files[i].isDirectory()) {refreshFileList(files[i].getAbsolutePath());} else {if(files[i].getName().toLowerCase().endsWith("zip"))filelist.add(files[i]);}}return filelist;}}ZipUtils.java如下:package com.once;import java.io.*;import java.util.ArrayList;import java.util.Collection;import java.util.Enumeration;import java.util.zip.ZipEntry;import java.util.zip.ZipException;import java.util.zip.ZipFile;import java.util.zip.ZipOutputStream;/*** Java utils 实现的Zip⼯具** @author once*/public class ZipUtils {private static final int BUFF_SIZE = 1024 * 1024; // 1M Byte/*** 批量压缩⽂件(夹)** @param resFileList 要压缩的⽂件(夹)列表* @param zipFile ⽣成的压缩⽂件* @throws IOException 当压缩过程出错时抛出*/public static void zipFiles(Collection<File> resFileList, File zipFile) throws IOException {ZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream( zipFile), BUFF_SIZE));for (File resFile : resFileList) {zipFile(resFile, zipout, "");}zipout.close();}/*** 批量压缩⽂件(夹)** @param resFileList 要压缩的⽂件(夹)列表* @param zipFile ⽣成的压缩⽂件* @param comment 压缩⽂件的注释* @throws IOException 当压缩过程出错时抛出*/public static void zipFiles(Collection<File> resFileList, File zipFile, String comment)throws IOException {ZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream( zipFile), BUFF_SIZE));for (File resFile : resFileList) {zipFile(resFile, zipout, "");}zipout.setComment(comment);zipout.close();}/*** 解压缩⼀个⽂件** @param zipFile 压缩⽂件* @param folderPath 解压缩的⽬标⽬录* @throws IOException 当解压缩过程出错时抛出*/public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {File desDir = new File(folderPath);if (!desDir.exists()) {desDir.mkdirs();}ZipFile zf = new ZipFile(zipFile);for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {ZipEntry entry = ((ZipEntry)entries.nextElement());InputStream in = zf.getInputStream(entry);String str = folderPath + File.separator + entry.getName();str = new String(str.getBytes("8859_1"), "GB2312");File desFile = new File(str);if (!desFile.exists()) {File fileParentDir = desFile.getParentFile();if (!fileParentDir.exists()) {fileParentDir.mkdirs();}desFile.createNewFile();}OutputStream out = new FileOutputStream(desFile);byte buffer[] = new byte[BUFF_SIZE];int realLength;while ((realLength = in.read(buffer)) > 0) {out.write(buffer, 0, realLength);}in.close();out.close();}}/*** 解压⽂件名包含传⼊⽂字的⽂件** @param zipFile 压缩⽂件* @param folderPath ⽬标⽂件夹* @param nameContains 传⼊的⽂件匹配名* @throws ZipException 压缩格式有误时抛出* @throws IOException IO错误时抛出*/public static ArrayList<File> upZipSelectedFile(File zipFile, String folderPath,String nameContains) throws ZipException, IOException {ArrayList<File> fileList = new ArrayList<File>();File desDir = new File(folderPath);if (!desDir.exists()) {desDir.mkdir();}ZipFile zf = new ZipFile(zipFile);for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {ZipEntry entry = ((ZipEntry)entries.nextElement());if (entry.getName().contains(nameContains)) {InputStream in = zf.getInputStream(entry);String str = folderPath + File.separator + entry.getName();str = new String(str.getBytes("8859_1"), "GB2312");// str.getBytes("GB2312"),"8859_1" 输出// str.getBytes("8859_1"),"GB2312" 输⼊File desFile = new File(str);if (!desFile.exists()) {File fileParentDir = desFile.getParentFile();if (!fileParentDir.exists()) {fileParentDir.mkdirs();}desFile.createNewFile();}OutputStream out = new FileOutputStream(desFile);byte buffer[] = new byte[BUFF_SIZE];int realLength;while ((realLength = in.read(buffer)) > 0) {out.write(buffer, 0, realLength);}in.close();out.close();fileList.add(desFile);}}return fileList;}/*** 获得压缩⽂件内⽂件列表** @param zipFile 压缩⽂件* @return 压缩⽂件内⽂件名称* @throws ZipException 压缩⽂件格式有误时抛出* @throws IOException 当解压缩过程出错时抛出*/public static ArrayList<String> getEntriesNames(File zipFile) throws ZipException, IOException { ArrayList<String> entryNames = new ArrayList<String>();Enumeration<?> entries = getEntriesEnumeration(zipFile);while (entries.hasMoreElements()) {ZipEntry entry = ((ZipEntry)entries.nextElement());entryNames.add(new String(getEntryName(entry).getBytes("GB2312"), "8859_1"));}return entryNames;}/*** 获得压缩⽂件内压缩⽂件对象以取得其属性** @param zipFile 压缩⽂件* @return 返回⼀个压缩⽂件列表* @throws ZipException 压缩⽂件格式有误时抛出* @throws IOException IO操作有误时抛出*/public static Enumeration<?> getEntriesEnumeration(File zipFile) throws ZipException,IOException {ZipFile zf = new ZipFile(zipFile);return zf.entries();}/*** 取得压缩⽂件对象的注释** @param entry 压缩⽂件对象* @return 压缩⽂件对象的注释* @throws UnsupportedEncodingException*/public static String getEntryComment(ZipEntry entry) throws UnsupportedEncodingException { return new String(entry.getComment().getBytes("GB2312"), "8859_1");}/*** 取得压缩⽂件对象的名称** @param entry 压缩⽂件对象* @return 压缩⽂件对象的名称* @throws UnsupportedEncodingException*/public static String getEntryName(ZipEntry entry) throws UnsupportedEncodingException {return new String(entry.getName().getBytes("GB2312"), "8859_1");}/*** 压缩⽂件** @param resFile 需要压缩的⽂件(夹)* @param zipout 压缩的⽬的⽂件* @param rootpath 压缩的⽂件路径* @throws FileNotFoundException 找不到⽂件时抛出* @throws IOException 当压缩过程出错时抛出*/private static void zipFile(File resFile, ZipOutputStream zipout, String rootpath)throws FileNotFoundException, IOException {rootpath = rootpath + (rootpath.trim().length() == 0 ? "" : File.separator)+ resFile.getName();rootpath = new String(rootpath.getBytes("8859_1"), "GB2312");if (resFile.isDirectory()) {File[] fileList = resFile.listFiles();for (File file : fileList) {zipFile(file, zipout, rootpath);}} else {byte buffer[] = new byte[BUFF_SIZE];BufferedInputStream in = new BufferedInputStream(new FileInputStream(resFile),BUFF_SIZE);zipout.putNextEntry(new ZipEntry(rootpath));int realLength;while ((realLength = in.read(buffer)) != -1) {zipout.write(buffer, 0, realLength);}in.close();zipout.flush();zipout.closeEntry();}}}希望本⽂所述对⼤家的Android程序设计有所帮助。
设计一个移动应用程序的英语作文
设计一个移动应用程序的英语作文全文共6篇示例,供读者参考篇1Designing My Own Mobile AppHi there! My name is Alex, and I'm a 10-year-old kid who loves playing with gadgets and apps. Lately, I've been thinking about creating my own mobile app, and I want to share my ideas with you!First things first, what kind of app should I make? Well, I've always been fascinated by games, so I think it would be cool to design a fun and exciting game app. But not just any ordinary game – I want to create something unique and different from all the other games out there.One idea that popped into my head was a game where you're a brave explorer on a mission to discover hidden treasures in mysterious caves and ancient ruins. You'd have to solve puzzles, dodge traps, and battle fierce monsters to reach the ultimate prize – a legendary artifact with incredible powers!As you progress through the game, you could unlock new weapons, tools, and abilities to help you on your quest. Maybe you could even team up with friends and go on adventures together, or compete against each other to see who can collect the most treasures.But wait, there's more! What if the game had different worlds or environments to explore, like a frozen tundra, a scorching desert, or even a futuristic city? That way, the gameplay would always feel fresh and exciting, and you'd never get bored.Now, I know what you're thinking: "Alex, that sounds like an amazing game, but how are you going to make it?" Well, I'll let you in on a little secret – I've been teaching myself how to code! With the help of some online tutorials and coding camps, I've learned the basics of programming languages like Python and JavaScript.And who knows, maybe one day my little game app will become a big hit, and people all around the world will be playing it! Wouldn't that be awesome?But even if my app doesn't become a global phenomenon, I'll still be proud of myself for trying something new and challenging. The process of designing and creating an app fromscratch will teach me so many valuable skills, likeproblem-solving, creativity, and perseverance.So, what do you think of my idea? Are you excited to see what kind of awesome app I'll come up with? I'll be sure to keep you updated on my progress!In the meantime, if you have any suggestions or ideas for my game, feel free to share them with me. I'm always open to new ideas and feedback from my friends and family.Well, that's all for now, folks! Time for me to get back to coding and bringing my dream app to life. Wish me luck!篇2Designing a Mobile AppHi there! My name is Jamie and I'm 10 years old. I love using apps on my mom's phone and tablet. My favorite apps are games, but I also like using apps that let me be creative like drawing apps and apps for making videos. I think it would be so cool to design my own app! Let me tell you all about the app I would create if I could.My app would be called "Jam's Awesome App" because Jamie is my name but my nickname is Jam. And of course, myapp has to be awesome! It would be available for both phones and tablets because I use both. You could download it from the app store for free.The main part of my app would be a game, because I love playing games on apps. It would be an adventure game where you create your own character and go on quests. You could customize what your character looks like by picking their hair, skin, and clothes. Then you would go through different worlds and scenes dealing with challenges along the way.In one world, you might be in a forest and have to figure out how to cross a river or climb up a mountain. In another world, it could be in outer space and you have to repair your spaceship or fight alien creatures. There would be puzzles to solve and obstacles to get through in each area before you could progress.As you go through the levels, you would earn coins or gems that you could use to get power-ups or accessories for your character. Maybe you could buy a jetpack that lets you fly over barriers. Or you could get magic spells to zap enemies in your way. The further you get, the more difficult it would become but also the more rewards you could earn.In between game levels, there would be a creation mode where you could design your own worlds and scenes. You coulddraw the backgrounds, place objects and characters, and build levels for others to play through. Kind of like letting kids make their own video games inside the app. Then your levels could get shared and other players could try them out.There would also be a section for making art and animations. You could draw pictures and make them come to life by adding animation. Don't you think it would be so satisfying to draw a monster and then see it walk around and make noises? You could make animated stickers to share with your friends too.And no app would be complete without photo editing tools! My app would let you take pictures or import photos and edit them however you want. You could add stickers and doodles, apply filters, warp and distort photos, and more. The editing tools would be really easy to use so anyone could tap and drag to customize their photos. Maybe there could even be cartoon avatar creators where you design a cartoon version of yourself.Since this is my dream app, I would package everything I love into one! Games, world building, art and animation, photo editing - my "Jam's Awesome App" would have it all. Of course, I'd probably need a huge team of developers and designers to actually build this app. But if I could create any app I wanted, that's definitely what I would make.An app with so many different creative tools means you could spend hours playing games and making things without ever getting bored. And the best part is you could share all your creations with friends who have the app too! You could play each other's game levels, react to their animated videos, and basically just have a blast expressing yourselves.Well, that's my idea for the ultimate app. A mega creative hub packed with games, design tools, and everything artsy kids like me could want! I may only be 10 years old but I've got huge dreams. Who knows, maybe one day I'll learn to code and develop apps for real. Until then, I'll keep daydreaming about "Jam's Awesome App!"篇3Designing My Own Mobile AppHi there! My name is Lily, and I'm a 10-year-old girl who loves playing games on my mom's phone. I've always wondered how those cool apps are made. So, I decided to design my very own mobile app! Let me tell you all about it.The first thing I did was think about what kind of app I wanted to create. I love animals, especially cute and cuddly ones like puppies and kittens. That's when it hit me – I could make avirtual pet app! In my app, you could adopt, name, and take care of your very own digital pet.Next, I had to decide what my pet would look like. After lots of sketching, I settled on a friendly-looking puppy with big eyes and floppy ears. I wanted to give players the option to customize their pet's fur color and other features to make it truly their own.Once I had the pet design ready, I started thinking about all the things you could do with your virtual buddy. Of course, you'd need to feed it, give it water, and play games to keep it happy and healthy. But I also wanted to include some extra fun activities.One idea I had was a virtual park where you could take your pet for walks and let it run around and play fetch. There could even be other players' pets there to make friends with! Another cool feature would be a grooming station where you could give your pet fun haircuts and accessories.To make the app really interactive, I thought it would be neat if the pet could learn tricks that you teach it. You could use your phone's microphone to record your voice saying commands like "sit", "roll over", or "shake". Then you'd practice with your pet until it learns the new trick. Imagine how proud you'd feel when your virtual puppy finally masters a hard trick!To keep things fun and exciting, I'd want to add new items, toys, and activities to the app through regular updates. There could even be special monthly or yearly events withlimited-edition items. For example, during the winter holidays, your pet could wear a Santa hat and play in the snow!Making this app would probably take a lot of work from professional developers and designers. But I like to think they'd have just as much fun dreaming up creative ideas as I did. Who knows, maybe my pet app concept will inspire them to make it a reality one day!Well, that's my idea for the ultimate virtual pet app. I put a lot of thought into making it as fun and interactive as possible. Taking care of a pet is an awesome responsibility, and I wanted to capture that experience in app form. I can't wait to see what sorts of cool apps get created in the future. Maybe I'll be designing them myself when I'm older!篇4Designing My Own Mobile AppHey there, friends! Have you ever thought about creating your own mobile app? It's super cool and fun to imagine an app that could help make our lives easier or more enjoyable. Today,I'm going to share my ideas for designing the ultimate mobile app for kids like us!First things first, what kind of app should it be? Well, after giving it some thought, I think it would be awesome to have an app that combines learning with playing games. That way, we can have a blast while also exercising our brains and picking up new knowledge. Sounds like a win-win to me!The app could have different sections for different subjects like math, science, history, and languages. Each section would have a variety of educational games and activities tailored to our age group. For example, in the math section, we could play games that help us practice addition, subtraction, multiplication, and division in a fun and interactive way.In the science section, we could learn about cool topics like the solar system, different types of animals, and how things work through engaging quizzes and simulations. The history section could transport us back in time to explore ancient civilizations, famous historical figures, and major events that shaped the world.And in the languages section, we could learn new words and phrases in different languages through games, songs, andstories. Imagine being able to speak a few sentences in French, Spanish, or Mandarin – how awesome would that be?But wait, there's more! The app could also have a creative corner where we can unleash our artistic talents. We could draw, paint, or even create our own comic strips or animated stories. Plus, there could be a built-in camera feature that allows us to take fun photos and add special effects or filters to them.To make the app even more exciting, we could have weekly or monthly challenges and competitions. For example, there could be a math challenge where we compete against other app users to see who can solve the most equations or word problems correctly. The winners could earn special badges, rewards, or even real-life prizes!Another cool feature could be the ability to connect with friends who also have the app. We could team up to play multiplayer games, work on group projects, or even chat and share our creations with each other. It would be like having a virtual playdate or study group right at our fingertips!Safety is also super important, so the app would have strict parental controls and privacy settings to keep us protected while we're learning and playing.Phew, just thinking about all these possibilities has me so excited! Imagine having an app like this that combines education, creativity, and fun all in one place. We could learn new things, challenge ourselves, and connect with friends, all while having a blast on our tablets or smartphones.Now, I know what you might be thinking – "But Timmy, how are we supposed to actually build an app like this? We're just kids!" Well, you've got a point there. Creating a mobile app from scratch is no easy feat, and it would require a team of skilled developers, designers, and programmers.But you know what? That's not going to stop us from dreaming big! Who knows, maybe one day when we're older and have gained more knowledge and experience, we could turn this app idea into a reality. Or maybe we'll come across someone who has the resources and expertise to help bring our vision to life.Either way, it's important to let our imaginations run wild and think of innovative ideas, even if they seem a bit far-fetched at the moment. That's how many of the coolest inventions and technological advancements in the world were born – from someone's crazy, out-of-the-box idea.So, what do you say, friends? Are you ready to join me in designing the ultimate mobile app for kids? Let's put our heads together, share our craziest ideas, and maybe, just maybe, we'll end up creating something truly amazing and unforgettable.The possibilities are endless when we use our creativity and work together! Let's get brainstorming!篇5Designing My Dream AppHi there! My name is Emma, and I'm 10 years old. I love using apps on my mom's phone or my tablet. There are so many cool games, tools, and fun activities. But you know what would be even better? Creating my very own app! If I could design an app, it would be the coolest thing ever. Let me tell you all about the amazing app I would make.First off, my app would be lots of fun. Fun is the most important part! It would have games, for sure. Maybe an endless runner game where you play as a cute animal trying to escape a hungry bear. Or a matching game with crazy patterns and vibrant colors. Ooh, or even a virtual pet that you can feed, play with, and take care of. The games would be challenging but not toohard. I would want kids my age to be able to play and enjoy them.Speaking of kids my age, that's exactly who my app would be for – children! Too many apps these days are made for adults or teenagers. We kids need an app that is just for us. The games would be kid-friendly, with no scary or inappropriate content. And the app would be easy to navigate, with big buttons and simple menus that little hands can manage.The absolute coolest part of my app would be the creative tools. I dream of an extremely powerful but user-friendly drawing tool. Picture an unlimited canvas with a rainbow of colors and all sorts of brushes, stamps, stickers and special effects. Kids could create masterpieces or just doodle for fun. Maybe the app could even have some basic animation or comic-making capabilities!For kids who prefer words over artwork, there could be a simple storytelling section. It would provide helpful prompts and cues to spark creativity. Then kids could type or record their own fictional tales about space ninjas, talking animals, or whatever they can imagine. The app could have a library to store and share their stories with family members.No super awesome kid app would be complete without some fun avatar customization. Users could design their own unique character or persona to represent them. They could pick the avatar's hairstyle, clothing, accessories, and more. Maybe the avatar could even "level up" and earn fun new items as rewards for achievements in the app's activities.My app would be absolutely overflowing with vibrant colors, playful sounds, and interactive surprises around every corner. It would feel like a living, breathingplayground where kids could explore their curiosity and creativity. But it would also be a safe digital space, without ads or inappropriate content. Just pure fun and educational awesomeness!One of the hardest parts of creating an app is picking the perfect name. I've been racking my brain trying to think of a name for mine. Some ideas I had were "Kidtopia," "Funzone," "Laugh 'n' Learn," or "Exploracle." I can't decide which one I like best. Maybe I'll have a contest and let kids vote on their favorite name!Developing an app seems like a ton of work, but I think it would be worth it to create something super cool for kids. We could use some more apps built with us in mind instead of as an afterthought. If any grown-ups out there want to hire a10-year-old consultant, I'll be sure to slip them my room&board demands. Half my body weight in gummy bears ought to cover it!Anyway, that's my idea for the ultimate kid-friendly,fun-focused, creativity-packed mobile app experience. A space filled with games, learning activities, creative tools, and more silliness than you can shake a selfie stick at. An app made just for kids, by kids. At least, that's how I would design it if I could. A kid can dream, can't she? Now if you'll excuse me, I have a very important hour of screaming cartoon voices to attend to. See you in the app store!篇6Designing My Own Mobile AppHave you ever wished you could make your own app for your phone or tablet? Well, I have and I'm going to tell you all about the app I would create if I could! It would be so cool and fun. I've put a lot of thought into this.First off, my app would be a game. I love playing games on my mom's phone whenever she lets me. There are so many good ones, but I always run out of lives or can't get past certain levels.With my app, I would be the boss! There wouldn't be any limits on lives or levels that are too hard.The game would be all about outer space. I'm really interested in planets, stars, black holes, and everything else out in the cosmos. In my game, you would get to explore different planets, gather materials, and build a rocket ship. The ultimate goal would be to create the most powerful rocket that could blast you all the way across the galaxy!On the very first level, you'd start out on Earth. You'd have a few tasks to complete to gather supplies like metals and fuel. Maybe you'd need to go on mini quests to mine materials from the ground or collect specific items from certain locations. Drilling for oil could give you fuel, and old satellites or ships could provide steel and other resources.Once you did that, you could start putting together a basic rocket. It probably wouldn't be able to go too far at first. Like maybe it could only get you to the Moon. But that would be an exciting start!When you got to the Moon, there would be all sorts of new challenges and opportunities. The landscape would be totally different than Earth. Hey, did you know there are massive cavesand underground tunnels on the Moon? How cool would it be to explore those looking for Moon rocks and other treasures?You'd definitely find a lot of rare materials on the Moon that you could use to upgrade your rocket. Making it bigger and more powerful would be the key to reaching other planets and environments.Just imagine how fun it would be to soar past the asteroids belts, visiting planet after planet. On Mars, you could collect compressed gas to create forcefield bubbles that would let you walk around outside without a spacesuit. Pretty neat, right?Further out, who knows what you'd find? There could be abandoned alien settlements on the moons of Jupiter, Saturn, or Neptune where you get to investigate and scavenge for parts. Maybe you'd run into alien life forms and they'd give you special tools or coding skills if you were friendly.The creatures and worlds would just get weirder and weirder the deeper into the galaxy you traveled. At some point, you may even need to upgrade your whole rocket and rebuild it using some mindboggling technologies you discovered. That's the adventure I want to go on!But getting supplies and building all those ships and rockets wouldn't be easy. I'm picturing難しいレベル(difficult levels) where you face epic challenges and galactic battles against forces trying to stop you. 災害(災害) like rogue comets, blackholes, or meteors could destroy parts of your spacecraft if you don't have strong shields. 最後に、敵のspaceships or evil groups could attack and board your rocket, trying to sabotage or hijack it. You'd need to fight them off in intense combat sections to keep going.Those would be crazy hard modes for sure! But I would make the earlier levels nice and simple so kids my age could play and not get too frustrated. The whole game would have a big skill range so it could start easy and get insanely difficult and complex for really incredible players.That modularity and open-endedness is what I'd really want my game to be about. Not just being a straightforward explore-and-collect adventure, but a sandbox universe where players could get wildly creative and break cosmic rules if they mastered the skills. Who knows, maybe the best gamers would figure out reality hacks that let them accomplish things even I couldn't conceive of!Those are just some starting thoughts, but I have so many more ambitious plans for my cosmic space odyssey app. It would have an endless number of randomly generated levels and situations. The most hardcore players would likely never even experience most of what's possible! I'm talking aboutnear-infinite replay value.The graphics would be state-of-the-art photo-realistic. Sometimes you'd hardly be able to tell if the alien vistas and cosmic phenomena were real or not. I'd hire the best developers and animators in the world to make it all look and feel just breathtaking.And the music and sound effects? Forget about it. I'd bring in whole orchestras and famous rock bands to createmulti-layered, dynamic soundtracks that would immerse players to their core. Every environment, character, and situation would have its own unique auraltextures to produce a completely visceral experience unlike anything in just movies or games today.With so much ambition and scope, it would probably take a massive team of programmers years upon years to develop all the content and systems for an app like this. We're talking abouthundreds of people crunching mind-bending levels of code and assets.Not only that, but I'd want to heavily integrate the latest technologies and discoveries from science and innovation. Developments in quantum computing, AI, astrophysics, nanotechnology - I'd somehow want my app to leverage those advancements and let people explore the outer realms of what's possible for real. No holding back or limiting the imagination.So yeah... it'd probably end up being one of the most complex, sophisticated, and insanely ambitious apps ever created. But I'm thinking big with this one! Why aim small when you can aim for something truly universe-shattering and revolutionary? That's always been my attitude.In the end, I know it may sound a bit far-fetched and wildly optimistic coming from a kid. How could I make something so grand and visionary all on my own, right? Well, you have to start somewhere! Even brainstorming and dreaming it up in the first place is a solid first step towards actually doing it. If I make up my mind to be as devoted and unstoppable as I can be, who's to say my app fantasy couldn't eventually become a blockbuster reality?I'll never give up on my wild ideas for building something amazing. That's the approach innovators and visionaries have to take if they want to accomplish the seemingly impossible. No matter how old I get, I'll keep letting my childhood dreams and imagination lead the way to greatness!。
如何使用一款手机app英语作文
如何使用一款手机app英语作文全文共3篇示例,供读者参考篇1Title: How to Use a Mobile App for English CompositionIn today's technologically advanced world, there are countless mobile apps available to assist with various tasks, including English composition. These apps can be extremely useful for students, writers, or anyone looking to improve their writing skills. In this article, we will explore how to effectively utilize a mobile app for English composition.1. Choose the Right App:The first step in using a mobile app for English composition is to choose the right app. There are many apps available, each with different features and capabilities. Some popular apps for English composition include Grammarly, Hemingway Editor, and Evernote. It is important to choose an app that aligns with your specific writing needs and goals.2. Set Up Your Account:Once you have chosen an app, the next step is to set up your account. This typically involves creating a username and password, as well as providing some basic information about yourself. Some apps may also require you to link your account to your email or social media accounts.3. Explore the Features:After setting up your account, take some time to explore the features of the app. Most English composition apps offer a variety of tools to help improve your writing, such as grammar and spell check, style suggestions, and word count tracking. Familiarize yourself with these features so you can make the most of the app.4. Practice Writing:One of the best ways to improve your English composition skills is to practice writing regularly. Use the app to write essays, articles, blog posts, or any other type of writing that interests you. Take advantage of the app's editing tools to improve your writing and learn from your mistakes.5. Seek Feedback:Many English composition apps offer the ability to seek feedback on your writing from other users or professionaleditors. This can be a valuable opportunity to receive constructive criticism and improve your writing skills. Take advantage of this feature to get feedback on your work and make necessary revisions.6. Set Goals:To stay motivated and track your progress, set goals for yourself when using the app for English composition. This could include writing a certain number of words per day, improving your grammar and spelling skills, or completing a writing project by a specific deadline. Setting goals will help you stay focused and committed to improving your writing.7. Stay Consistent:Consistency is key when it comes to improving your English composition skills. Make a habit of using the app regularly to practice writing, receive feedback, and track your progress. By staying consistent, you will gradually improve your writing skills and become a more proficient writer.In conclusion, using a mobile app for English composition can be a valuable tool for improving your writing skills. By choosing the right app, setting up your account, exploring the features, practicing writing, seeking feedback, setting goals, andstaying consistent, you can make the most of the app and enhance your English composition abilities. So, download a suitable app and start writing!篇2How to Use a Mobile App for English CompositionIn the modern era, technology has become an integral part of our daily lives. One of the most common devices we use is our mobile phone, and with it, we have access to a wide range of mobile apps that can make our lives easier and more convenient. When it comes to English composition, there are several apps available that can help us improve our writing skills and create well-crafted essays and articles. In this article, we will discuss how to use a mobile app for English composition effectively.1. Choose the right appThe first step in using a mobile app for English composition is to choose the right app for your needs. There are a plethora of apps available on both the App Store and Google Play that can help with grammar, spelling, and overall writing skills. Some popular apps include Grammarly, Hemingway, and Microsoft Word. Take some time to research and read reviews to find the app that best suits your requirements.2. Set specific goalsBefore you start using the app, it is essential to set specific goals for what you want to achieve. Do you want to improve your grammar and spelling, enhance your vocabulary, or work on forming more coherent arguments in your writing? By setting specific goals, you can tailor your use of the app to focus on areas where you need the most improvement.3. Practice regularlyLike any skill, writing requires practice to improve. Make it a habit to write regularly using the app. You can start with short exercises or journal entries and gradually work your way up to longer essays or articles. The more you practice, the more you will see improvement in your writing skills.4. Use the app's featuresMost English composition apps come with a variety of features to help you enhance your writing. These may include grammar and spell-check, suggestions for improving sentence structure, and tips for engaging your readers. Make sure to explore all the features the app offers and use them to your advantage.5. Seek feedbackTo truly improve your writing skills, it is essential to seek feedback from others. You can share your writing with friends, family, or teachers and ask for their thoughts and suggestions. Additionally, some apps may offer feedback and suggestions for improvement based on your writing. Take advantage of this feedback to make necessary revisions and grow as a writer.6. Read and learnIn addition to practicing writing, it is essential to read articles, essays, and books to expand your knowledge and understanding of the English language. Reading can expose you to different writing styles, vocabulary, and ideas that can inspire and inform your own writing. The more you read, the more you will internalize good writing practices and apply them in your own compositions.7. Stay motivatedImproving your writing skills through a mobile app may take time and effort, so it is crucial to stay motivated and committed to your goals. Set aside dedicated time each day for writing practice, and celebrate your progress and achievements along the way. Remember that every step you take towards enhancing your writing skills brings you closer to becoming a proficient and confident writer.In conclusion, using a mobile app for English composition can be a valuable tool for improving your writing skills and creating well-crafted essays and articles. By choosing the right app, setting specific goals, practicing regularly, utilizing the app's features, seeking feedback, reading and learning, and staying motivated, you can enhance your writing abilities and express yourself effectively in English. So, download a writing app today and start your journey towards becoming a skilled writer!篇3How to Use a Mobile App for Writing English CompositionsIn this digital age, many students are turning to mobile apps to help improve their English writing skills. One popular way to do this is by using a dedicated writing app that provides tools and resources to help users create well-written compositions. In this article, we will discuss how to effectively use a mobile app for writing English compositions.1. Choose the right appThe first step in using a mobile app for writing English compositions is choosing the right app for your needs. There are many writing apps available on the market, so it's important to do some research and find one that offers the features you need.Look for apps that provide grammar and spell-checking tools, as well as templates and prompts to help you get started.2. Set writing goalsOnce you have chosen a writing app, it's important to set specific writing goals to help you stay focused and motivated. Whether you want to write a certain number of words each day or complete a composition by a certain deadline, having clear goals will help you track your progress and make improvements.3. Use templates and promptsMany writing apps offer templates and prompts to help users get started with their compositions. These can be helpful for students who are struggling to come up with ideas or structure their writing. Take advantage of these resources to jumpstart your writing process and generate new ideas.4. Practice writing regularlyTo improve your English writing skills, it's important to practice writing regularly. Set aside time each day to work on your compositions, even if it's just for a few minutes. The more you practice, the better you will become at expressing your ideas clearly and effectively.5. Get feedbackOne of the advantages of using a mobile app for writing is that you can easily share your compositions with others and get feedback on your work. Show your compositions to teachers, classmates, or friends, and ask for their input on how you can improve. Use their feedback to make revisions and refine your writing skills.6. Edit and reviseAfter you have finished writing a composition, take the time to edit and revise it. Look for grammatical errors, awkward phrasing, and unclear ideas, and make the necessary changes to improve your writing. Remember, writing is a process, and revision is an important part of creating a polished composition.7. Set aside time for reflectionFinally, it's important to set aside time for reflection after you have completed a composition. Think about what went well, what could be improved, and what you have learned from the writing process. Use this reflection to guide your future writing practice and continue to grow as a writer.In conclusion, using a mobile app for writing English compositions can be a valuable tool for students looking to improve their writing skills. By choosing the right app, settingwriting goals, using templates and prompts, practicing regularly, seeking feedback, editing and revising, and reflecting on your writing process, you can become a more confident and proficient writer. So, what are you waiting for? Start using a mobile app for writing English compositions today and watch your writing skills soar!。
安卓软件安装与刷机教程
Android软件安装Android软件一般后缀名都是apk,如果不是的话,看是否是rar格式的压缩文件,或者更改下后缀名就可以了。
安装Android软件的方法也很简单,有以下几种方法进行安装:1.使用Android手机自带的谷歌Android Market在线软件店,进入后选择想要下载的软件就可以直接付费下载安装,试用后如果不喜欢还是可以退货的。
2.也可以直接将下载安装文件存放在手机的SD卡中,然后直接在文件管理器中点击安装。
3.可以在PC端安装APK安装器,然后将Android手机连接电脑后,利用APK安装器批量的安装应用程序。
智能手机能与PC间进行联系和实时更新相关信息,使手机与PC的相关信息随时保持一致,这样不管走到哪里,可以确保你的手机的资料和相关信息都与PC上是相同的。
PC 上的信息资料, 如Outlook联系人/日程安排,日记、日历、任务和邮件等等,都可以同步到手机上,这样就可以让手机充当私人助理的角色,无需打开电脑进行相关的工作了,经常外出的商务人士有了这样的功能是很方面的。
Android系统是使用Linux打造的,所以与Windows的PC 是不能直接相连的,必须使用第三方的软件进行协调。
目前HTC手机可使用自己的HTC Sync同步软件,目前的最新版本是2.0.33。
这里要注意的是,如果手机使用的是1.5的固件,那使用H TC Sync2.0.18是没有问题的,如果手机是2.1固件的,就一定要用HTC Sync2.0.25以上的版本才行。
电脑系统要求:WindowsXP/2000/Vista/7,内存至少512M,硬盘空间至少50M,USB要支持2.0标准1. 检查之前是否安装过其他版本的HTC Sync,如果是,请先卸载(方便的话,卸载完后先重启一下,目的是为了保证系统最大限度的兼容性和稳定性)2. 下载最新版本的HTC Sync2.0.33到电脑上http://www. /tw/SupportViewNews.aspx?dl_id=933&news_id= 631复制代码官方下载地址3. 安装最新版本的HTC Sync2.0.33到电脑上(注意:如果电脑有杀毒软件或防火墙正在运行,需先关闭这些)安装完毕后,电脑屏幕右下方会新增一个HTC Sync的图标。
Android项目打包成APK程序的过程
Android项目打包成APK程序的过程
当一个Android程序编写完成之后,可以将程序进行打包,以便在手机上执行。
备注:Android操作系统与大部分的手机操作系统相比,最方便的地方就在于可以方便地实现打包操作,不再因为手机厂商的不同而采用不同的方式打包程序。
第1步:首先需要修改AndroidManifest.xml文件,在文件中增加一个安装程序包的权限。
<uses-sdk android:minSdkVersion="7"/>
第3步:选择要打包的项目。
第4步:如果要导出项目,首先需要建立一个证书。
证书保存在E:\Android文件夹下,证书密码为firstapk。
备注:朋友们可以灵活选择保存路径,和密码。
第5步:填写完整的证书信息。
第6步:选择导出项目的保存路径。
执行完毕之后,就可以在磁盘上看到相应的APK文件了。
此外,还可直接将导出的HelloWorld.apk程序安装在Android手机上执行了。
至于,如何将APK文件安装在手机,请参阅我的另一篇文章《如何安装APK文件到自己的android手机里.pdf》。
Android应用程序包 坏的、好的和更好的说明书
Android parcels: the bad, the good and the better Introducing Android’s Safer ParcelHao KeBernardo RufinoYang YangMaria UretskyAbout UsHao Ke (@haoOnBeat)Security EngineerAndroid Malware ResearchGoogleBernardo RufinoSoftware EngineerAndroid Platform SecurityGoogleYang YangSecurity EngineerAndroid VRPGoogleSpecial thanksMaria Uretsky Tech Lead Android VRP Google Kevin Deus ISE Manager Android VRP GoogleAgenda●Parcel Mismatch problems●Bundle “FengShui” - Self changing Bundle ●Bundle “FengShui” - Making it safe(r)●CVE-2021-0928 (Novel in Android 12-beta) ●CVE-2021-0928 - Making it safe(r)●Parcel Mismatch and Android VRP●QuestionsParcel Mismatch problems: Parcel and Parcelable●Parcel: A container for sending serialized (aka. parceled) data across binderIPCs.●Parcelable:○Sender Side: Objects serialized into the Parcel (writeToParcel)○Receiver Side:Reconstructed back into the original Object (createFromParcel)Parcel Mismatch problems: Parcelable Containersprivate void readListInternal (@NonNull List outVal , int N , @Nullable ClassLoader loader ) { while (N > 0) {Object value = readValue (loader ); outVal .add (value ); N --; }public final Object readValue (@Nullable ClassLoader loader ) {int type = readInt ();switch (type) {case VAL_PARCELABLE :return readParcelable (loader );…case VAL_LIST :return readArrayList (loader );}…●“A final class of methods are for writing and reading standard Java containers of arbitrary types.”●Array, List, ArrayList, Map, SparseArray..public final ArrayList readArrayList (@Nullable ClassLoader loader ) { int N = readInt (); …ArrayList l = new ArrayList (N ); readListInternal (l , N , loader ); return l ;}Parcel Mismatch problems: Parcelable Containers: Cont’d ●Deserializes “everything” in the container○Other containers○Parcelables and Serializables○(Parcelables and Serializables in other containers)●Of Arbitrary types○Deserializes Parcelables or Serializables of any typeParcel Mismatch problemsParcelable Write:public void writeToParcel(Parcel parcel,int flags){parcel.writeInt(f1);parcel.writeByteArray(f2);}Parcelable Read:f1 = parcel.readInt();if(f1 >0) {parcel.readByteArray(f2); }Parcel Mismatch problems: Cont’d● A parcelable write/read mismatch makes the next entry read be misaligned ●Then, the receiver deserializes the data in an unexpected wayBundle “FengShui” - Self changing Bundle●Bundle b = new Bundle()// Fill bBundle c = new Bundle(b.writeToParcel())● b "!=" c => Self-changing bundleSerializationDeserializationSimulates sending b over processes (IPC)Bundle “FengShui” - Self changing Bundle ●Vulnerable example●Leveraged in following cross-processflow:○A: Sends Bundle x to B○A: <x is serialized>○B: <x is deserialized>○B: Inpects x (TOC) and sends to C○B: <x is serialized>○C: <x is deserialized>○C: Uses x (TOU)●Challenge: Hide item ("intent" => 42)in Bundle from B○Item only appears to C○In Android 12Bundle “FengShui” - Self changing BundleA ===(PA )====>B ====(PB)===> CBundle “FengShui” - Self changing BundleVulnerable A ===(PA)====> B ====(PB)===> CBundle “FengShui” - Self changing BundleBundle “FengShui” - Self changing BundleBundle “FengShui” - Self changing BundleBundle “FengShui” - Self changing BundleBundle “FengShui” - Self changing BundleAndroid 12/SBundle “FengShui” - Self changing Bundle: ExploitsDifferent!Bundle “FengShui” - Self changing Bundle: Exploits ●Abuses AccountManagerService○Where KEY_INTENT check happens○TOCTOU mismatch:■Bundle object ("self-")changed from deserialization to reserialization ●Triggers arbitrary Activity launching, from Settings app○Settings app (uid=1000 SYSTEM_UID) is privileged and can launch arbitrary activities○“LaunchAnyWhere”●Knowingly used in Malware campaigns (not covered in this talk)○Silently install packages●Fix the individual r/w mismatches○Yes, but doesn't scale●Fix AccountManagerService○Yes, but what about other code paths?●Fix Bundle○Yes!○What's wrong with Bundle?○=> Lazy Bundle●Fix the individual r/w mismatches => Yes, but doesn't scale…more●Fix the individual r/w mismatches○Yes, but doesn't scale●Fix AccountManagerService○Yes, but what about other code paths?●Fix Bundle○Yes!○What's wrong with Bundle?○=> Lazy Bundle●=> Fix AccountManagerService? YesBetween (6) and (7)=> b2 = unparcel(parcel(bundle))=> Verifyb2.get(KEY_INTENT) "==" bundle.get(KEY_INTENT)=> If not, fail and log●Fix the individual r/w mismatches○Yes, but doesn't scale●Fix AccountManagerService○Yes, but what about other code paths?●Fix Bundle○Yes!○What's wrong with Bundle?○=> Lazy Bundle●Fix Bundle○Yes!○What's wrong with Bundle?■Structure implicitly defined by the items and their payloads■Eager deserialization upon first retrieval/query ○=> Lazy Bundle●What's wrong with Bundle?○Structure implicitly defined by the items and their payloads ○If there is a r/w mismatch, the next read is affectedb.putParcelable("1", p1)b.putParcelable("2", p2) b.getParcelable("1")b.getParcelable("2")●What's wrong with Bundle?○Structure implicitly defined by the items and their payloads ○Prefix item lengthb.putParcelable("1", p1) b.putParcelable("2", p2)b.getParcelable("1")b.getParcelable("2")●What's wrong with Bundle?○Eager deserialization upon first retrieval/query○To read an item => read all previous items (in practice we read all the bundle)b.putParcelable("1", p1) b.putParcelable("2", p2)// b.getParcelable("1")b.getParcelable("2")●What's wrong with Bundle?○Eager deserialization upon first retrieval/query○With length prefix, we can skip items => only read (custom) items when queried ○=> Lazy bundleb.putParcelable("1", p1) b.putParcelable("2", p2)// b.getParcelable("1")b.getParcelable("2")●What's wrong with Bundle?○Lazy bundle: More resilient against system crashes / DoSBundle b =getIntent().getExtras() // Parcelled formb.getParcelable(k1)b // Map form●What's wrong with Bundle?○Lazy bundle: More resilient against system crashes / DoSParcelled formBundle b =getIntent().getExtras() // Parcelled formb.getParcelable(k1)b // Map form Map form●What's wrong with Bundle?○Lazy bundle: More resilient against system crashes / DoSBundle b =getIntent().getExtras() // Parcelled formb.getParcelable(k1)b // Map formX●What's wrong with Bundle?○Lazy bundle: More resilient against system crashes / DoSBundle b =getIntent().getExtras() // Parcelled formb.getParcelable(k1)b // Map form●What's wrong with Bundle?○Lazy bundle: More resilient against system crashes / DoSBundle b =getIntent().getExtras() // Parcelled formb.getParcelable(k1)b // Map formCVE-2021-0928 (Novel in Android 12-beta)●Arbitrary code execution in any app’s process (including system app processUID:1000)○Different exploit technique than Bundle FengShui○Fixed in Android 12’s official release○Reported and PoC-ed by Michał Bednarski (@BednarTildeOne)CVE-2021-0928 - Background: Broadcast What happens when an app calls sendBroadcast(intent) ?Background Cont’d: Broadcast - ActivityInfo Arbitrary code execution via tampering the ActivityInfo value.●ActivityThread (in app’s process) calls handleReceiver and eventually uses theapplicationInfo object (within ActivityInfo) to create a LoadedApk instance.●The LoadedApk object assigns the applicationInfo object’s sourceDir value to itsappdir, which is eventually used to to create the application’s classLoader.●Hence controlling the sourceDir value, the attacker application can make thevictim process load an attacker-controlled APK and execute arbitrary code from there.CVE-2021-0928 - The Mismatch●When exceptions occurs:○The read stops before fully consuming the data○Exceptions caught gracefullyCVE-2021-0928: OutputConfiguration Deserialization private OutputConfiguration(@NonNull Parcel source){int rotation = source.readInt();int surfaceSetId = source.readInt();int surfaceType = source.readInt();int width = source.readInt();int height = source.readInt();…boolean isMultiResolutionOutput =source.readInt()==1;ArrayList<Integer> sensorPixelModesUsed =newArrayList<Integer>();source.readList(sensorPixelModesUsed,Integer.class.getClassLoader());…}CVE-2021-0928: OutputConfiguration Deserializationprivate OutputConfiguration(@NonNull Parcel source){int rotation = source.readInt();int surfaceSetId = source.readInt();int surfaceType = source.readInt();int width = source.readInt();int height = source.readInt();…boolean isMultiResolutionOutput =source.readInt()==1;ArrayList<Integer> sensorPixelModesUsed =newArrayList<Integer>();source.readList(sensorPixelModesUsed,Integer.class.getClassLoader());…}CVE-2021-0928CVE-2021-0928CVE-2021-0928●system_server prepares the Parcel Object with Intent,ActivityInfo, other params●Victim app reads the Parcel object:○Exception only triggers when victim app’s deserializing the Intent○Read stops before data fully consumed○Exception handled, deserialization continues○Intent’s deserialization finished before the full Intent object is read○Starts reading ActivityInfo, from the wrong offset, within the attacker-controlled Intent object○……●Victim app execute the broadcast, using attacker controlledActivityInfo○Arbitrary code executionCVE-2021-0928 - Prerequisites●Parcelable R/W mismatch via triggering exceptions○Read “less” than write, causing the next parameter read at the wrong offset ○Exception only triggers in application’s process●Build PoC in the Intent object○Embed (R/W Mismatched) Parcelable objects in Intent. (Only became available in Android 12(S)-beta)CVE-2021-0928 - Prerequisites●Parcelable R/W mismatch via triggering exceptions○Read “less” than write, causing the next parameter read at the wrong offset○Exception only triggers in application’s process■ClassNotFoundException with system_server specific classPackageManagerException●Build PoC in the Intent object○Embed (R/W Mismatched) Parcelable objects in Intent. (Only became available in Android 12(S)-beta)CVE-2021-0928 - Prerequisites●Parcelable R/W mismatch via triggering exceptions○Read “less” than write, causing the next parameter read at the wrong offset ○Exception only triggers in application’s process●Build PoC in the Intent object○Embed (R/W Mismatched) Parcelable objects in Intent. (Only became available in Android 12(S)-beta)CVE-2021-0928 - PrerequisitesBuild PoC in the Intent object●Embed (R/W Mismatched) Parcelable objects in Intent. (Only became available inAndroid 12(S)-beta)splitDependencies = source.readSparseArray(null);readSparseArray - Parcelable Container method。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Brad Fitzpatrick May 20th, 2010
Live Wave: http://bit.ly/aU9bpD
Outline
• Me & why I care • What is an ANR? Why do you see them? • Quantifying responsiveness: “jank” • Android SDK features to use to avoid jankiness & ANRs • Numbers to know • War stories from optimizing Froyo (2.2) • New performance instrumentation available in Froyo • Q&A and/or tell me what you want • Note: not a talk on the Dalvik JIT (which is cool when CPUbound, but often not the problem)
3
About Me
• Brad Fitzpatrick • Pre-Google:
– / LiveJournal / Six Apart
• memcached, OpenID, MogileFS, Gearman, perlbal, djabberd, .... • … mix of Social + infrastructure • <3 Open Source
– given enough users, usage, time... – users will find your ANRs – bad Market reviews, uninstalls, – me filing bugs on your app :-)
13
Tools
android.os.AsyncTask
18
android.app.IntentService
• Eclair (2.0, 2.1) docs:
– “An abstract Service that serializes the handling of the Intents passed upon service start and handles them on a handler thread. To use this class extend it and implement onHandleIntent(Intent). The Service will automatically be stopped when the last enqueued Intent is handled.” – little confusing, thus... – nobody really used it
8
Numbers
Numbers (Nexus One)
• ~0.04 ms – writing a byte on pipe process A->B, B->A
– or reading simple /proc files (from dalvik)
• ~0.12 ms – void/void Binder RPC call A->B, B->A • ~5-25 ms – uncached flash reading a byte • ~5-200+(!) ms – uncached flash writing tiny amount (next...) • 16 ms – one frame of 60 fps video • 41 ms – one frame of 24 fps video • 100-200 ms – human perception of slow action • 108/350/500/800 ms – ping over 3G. varies! • ~1-6+ seconds – TCP setup + HTTP fetch of 6k over 3G
• doing network operations on main thread, • doing slow 'disk' operations (un-optimized SQL) on the main thread
• Less than 5 or 10 seconds, though...
– Users: “This app feels janky.” (or “sluggish”, “slow”, …)
– read, write, erase, wear-leveling, GC, …
• nutshell: write performance varies a lot
Source: empirical samples over Google employee phones (Mar 2010)
11
– Chrome's fanatically anti-jank – “Janky”: not being immediately responsive to input
• “Eliminating jank”
– Reacting to events quickly, – Don't hog the event loop (“main” / UI) thread! – Getting back into the select() / epoll_wait() call ASAP, so... – … you can react to future events quickly (touches, drags)
10
Writing to flash (yaffs2)
• Create file, 512 byte write, delete
– ala sqlite .journal in transaction
• Flash is … different than disks you're likely used to
– EXPLAIN vs. EXPLAIN QUERY PLAN
• log files: often much cheaper to append to a file than use a database
– look at “adb shell cat /proc/yaffs” and look at writes/erases – sqlite can be pretty write-happy
“AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.”
• Google:
– Social Graph API, ~Google Profiles – PubSubHubbub, WebFinger
• Now:
– Android performance – working on Open Source again!
4
Jank
Jank
• Chrome team's term for stalling the event loop
• sqlite-wrapper.pl tool
– /p/zippy-android/
• <demo>
12
Lessons so far
• Writing to disk is “slow” • Using the network is “slow” • Be paranoid. Always assume the worst.
Source: Froyo's src/com/android/browser/BrowserActivity.java, roughly
AsyncTask Caveats
• Must be called from a main thread
– rather, a thread with a Handler/Looper around – don't use AsyncTask in a library where caller could call it from their own AsyncTask. or, check first.
• If called from an activity, the activity process may exit before your AsyncTask completes
– user leaves activity, – system is low on RAM, – system serializes activity's state for later, – system kills your process (“just a replaceable activity!”) – if work is critical, use...
sqlite performance
• previous writes were what sqlite does on ~each transaction,
– even no-op transactions (since reported & fixed upstream)
• use indexes
int count = urls.length; long totalSize = 0; for (int i = 0; i < count; i++) { totalSize += Downloader.downloadFile(urls[i]); publishProgress((int) ((i / (float) count) * 100)); } return totalSize; } protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]); } protected void onPostExecute(Long result) { // on UI thread! // on UI thread!