附加图像显示了在两台不同机器中从同一项目生成的APK(解压缩)。
正如你所看到的,APK内容在两个场景中都是不同的。在第二个APK edu,lib或者Android.mk,classes.dex,LICENSE.txt,pocketsphinx.i,pocketsphinx_wrap.c不存在。我不明白为什么在不同机器上使用相同代码的APK内容存在差异。显然,第二个APK没有给我正确的输出,在尝试启动时,崩溃时出现以下日志:
01-01 00:17:13.092: DEBUG/dalvikvm(3458): Late-enabling CheckJNI
01-01 00:17:13.100: INFO/ActivityManager(2302): Start proc or.exp.voicereco for activity or.exp.voicereco/.CameraMain: pid=3458 uid=10070 gids={1015}
01-01 00:17:13.124: INFO/dalvikvm(2302): Zip is good, but no classes.dex inside, and no .odex file in the same directory
01-01 00:17:13.124: WARN/PackageManager(2302): IOException reading apk: /system/app/PocketSphinxDemo.apk
01-01 00:17:13.124: WARN/PackageManager(2302): java.io.IOException: /system/app/PocketSphinxDemo.apk
01-01 00:17:13.124: WARN/PackageManager(2302): at dalvik.system.DexFile.isDexOptNeeded(Native Method)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.pm.PackageManagerService.performDexOptLI(PackageManagerService.java:3172)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.pm.PackageManagerService.performDexOpt(PackageManagerService.java:3157)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.ensurePackageDexOpt(ActivityManagerService.java:1869)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:3876)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:4013)
01-01 00:17:13.124: WARN/PackageManager(2302): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:351)
01-01 00:17:13.124: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1616)
01-01 00:17:13.124: WARN/PackageManager(2302): at android.os.Binder.execTransact(Binder.java:338)
01-01 00:17:13.124: WARN/PackageManager(2302): at dalvik.system.NativeStart.run(Native Method)
01-01 00:17:13.131: INFO/dalvikvm(2302): Zip is good, but no classes.dex inside, and no .odex file in the same directory
01-01 00:17:13.131: INFO/ActivityManager(2302): app/or.exp.voicereco[RESUMED] app.idle/false ...realStartActivityLocked
01-01 00:17:13.131: WARN/PackageManager(2302): IOException reading apk: /system/app/PocketSphinxDemo.apk
01-01 00:17:13.131: WARN/PackageManager(2302): java.io.IOException: /system/app/PocketSphinxDemo.apk
01-01 00:17:13.131: WARN/PackageManager(2302): at dalvik.system.DexFile.isDexOptNeeded(Native Method)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.pm.PackageManagerService.performDexOptLI(PackageManagerService.java:3172)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.pm.PackageManagerService.performDexOpt(PackageManagerService.java:3157)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.ensurePackageDexOpt(ActivityManagerService.java:1869)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.am.ActivityStack.realStartActivityLocked(ActivityStack.java:601)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:3925)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:4013)
01-01 00:17:13.131: WARN/PackageManager(2302): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:351)
01-01 00:17:13.131: WARN/PackageManager(2302): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1616)
01-01 00:17:13.131: WARN/PackageManager(2302): at android.os.Binder.execTransact(Binder.java:338)
01-01 00:17:13.131: WARN/PackageManager(2302): at dalvik.system.NativeStart.run(Native Method)
01-01 00:17:13.147: INFO/dalvikvm(3458): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
01-01 00:17:13.155: DEBUG/AndroidRuntime(3458): Shutting down VM
01-01 00:17:13.155: WARN/dalvikvm(3458): threadid=1: thread exiting with uncaught exception (group=0x40b021f8)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): FATAL EXCEPTION: main
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{or.exp.voicereco/ or.exp.voicereco.CameraMain}: java.lang.ClassNotFoundException: or.exp.voicereco.CameraMain
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread.access$600(ActivityThread.java:125)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1149)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.os.Looper.loop(Looper.java:137)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread.main(ActivityThread.java:4368)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at java.lang.reflect.Method.invokeNative(Native Method)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at java.lang.reflect.Method.invoke(Method.java:511)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at dalvik.system.NativeStart.main(Native Method)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): Caused by: java.lang.ClassNotFoundException: or.exp.voicereco.CameraMain
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1873)
01-01 00:17:13.155: ERROR/AndroidRuntime(3458): ... 11 more
01-01 00:17:13.155: WARN/ActivityManager(2302): Force finishing activity or.exp.voicereco/.CameraMain
当我从一台机器编译并运行应用程序而不是在另一台机器上运行应用程序时,有人可以让我知道为什么我得到正确的输出。对于所有其他应用程序,生成的APK在第二台机器中是完美的。
非常感谢任何帮助。
此致 ANEES
PS:这是一个基于ndk的应用程序。