Android 命令:实现启动一个apk

Android 命令:实现启动一个apk
    1、产生背景:为了调试方便,常常希望通过知道apk的路径,直接去启动它,所以就写了这个命令2、使用方法:adb push launch /data/
adb push launch.jar /data/
adb shell
launch复制代码其实放到/system/下面也可以,把jar包放到/system/framework/下面,把launch命令放到/system/bin/下面,然后adb shell 进去,直接执行launch就可以了,传入apk的路径参数。3、eg:launch /data/app/abc.apk复制代码4、代码:Android.mk:
3d视频制作# Copyright 2008 The Android Open Source Project # LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_MODULE := launch include $(BUILD_JAVA_LIBRARY)
launch:
# Script to start "launch" on the device, which has a very rudimentary # shell. # export CLASSPATH=/system/framework/launch.jar exec app_process /system/bin com.androidmands.launch.Launch $* #export CLASSPATH=/data/launch.jar #exec app_process /data/ com.androidmands.launch.Launch $*
Launch.java:
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * /licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
package com.androidmands.launch;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.IActivityController;
import android.app.IActivityManager;
制作智能卡
import android.app.IInstrumentationWatcher;
import android.app.Instrumentation;
t.ComponentName;
t.Context;
t.IIntentReceiver;
t.Intent;
t.pm.IPackageManager;
t.pm.ResolveInfo; import android.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.AndroidException;
import android.view.Display;
import android.view.IWindowManager;
import java.io.BufferedReader;
生产企业原材料的订购与运输import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.URISyntaxException;
import java.util.HashSet;
import java.util.List;
import android.util.Log;
消弧消谐柜t.pm.ApplicationInfo;
t.pm.PackageInfo;
t.pm.PackageManager;
t.pm.PackageUserState;
t.pm.PackageParser;
import android.util.DisplayMetrics;
/** * Launch */
public class Launch
{
private static final String TAG = "Launch";
private IPackageManager mPM;
private IActivityManager mAm;
/** * Command-line entry point. * * @param args The command-line arguments */ 采果器
public static void main(String[] args){
(new Launch()).run(args); }
private void init(){
IPackageManager mPM = IPackageManager.Stub.Service("package"));
表面曝气机
mAm = Default();
}
private void run(String[] args) {

本文发布于:2024-09-22 22:32:46,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/4/277359.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:命令   路径   代码   调试   订购   原材料
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议