java
@Test
public static void findadb() throws InterruptedException {
String apkip="E:\\需求\\2023\\gql_1.0.1.apk";
String findname1="cmd /c cd E:\\appium\\android-sdk\\build-tools\\27.0.2";//没有进到这里
String s1 = Cmd.exeCmd(findname1);
System.out.println("s1"+s1);
Thread.sleep(500);
String findname2="aapt dump badging "+apkip;
String finds = Cmd.exeCmd(findname2);
try{
String substring = finds.substring(finds.indexOf("package: name='") + 15, finds.lastIndexOf("' versionCode="));
System.out.println("substring package name:"+substring);
}catch (Exception e){
e.printStackTrace();
}
}
代码是对的,但是报错原因是什么呢?
原因:
没有aapt,那么就把aapt.exe粘过来
再次运行: