我有一个我之前在Google Play商店和iTunes上发布过的应用,但我们还没有制作新版本大约6个月。在以前的版本中,我从来没有在Android设备上安装任何问题。我的方法很简单,只需将apk发送给我自己,点击它就可以加载。现在,该方法无效。该应用程序安装,但当它打开时,我只是收到一条消息说"不幸的是,已停止。
经过大量研究和许多尝试失败后,我终于找到了如何使用此命令通过命令行安装:
phonegap run android --device --verbose
至少给了我一些比以前更多信息的东西。以下是该命令的整个输出(在退出之前只挂起几分钟:
No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name "CraftsmanRepublic" to /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.3.5): 10305
Wrote out Android package name "com.m2.velexo" to /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/src/com/m2/velexo/MainActivity.java
Found extra default icon: www/res/icon/android/icon-48-mdpi.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/android/icon-72-hdpi.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/android/icon-96-xhdpi.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/blackberry/icon-80.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/blackberry/icon-80.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/webos/icon-64.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/windows-phone/icon-48.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Found extra default icon: www/res/icon/windows-phone/icon-173-tile.png (ignoring in favor of www/res/icon/android/icon-36-ldpi.png)
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in hooks directory for hook "after_prepare": hooks/after_prepare/node_modules
Skipped directory "/Users/dallascaley/Sites/scotch-box/velexo-mobile/hooks/after_prepare/node_modules" within hook directory
Executing script found in hooks directory for hook "after_prepare": hooks/after_prepare/update_platform_config.js
Running command: /Users/dallascaley/Sites/scotch-box/velexo-mobile/hooks/after_prepare/update_platform_config.js /Users/dallascaley/Sites/scotch-box/velexo-mobile
TypeError: _.keyBy is not a function
TypeError: Cannot read property 'permissions' of undefined
TypeError: _.keyBy is not a function
Command finished with error code 0: /Users/dallascaley/Sites/scotch-box/velexo-mobile/hooks/after_prepare/update_platform_config.js /Users/dallascaley/Sites/scotch-box/velexo-mobile
Running command: /usr/libexec/java_home
Command finished with error code 0: /usr/libexec/java_home
ANDROID_HOME=/Users/dallascaley/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Subproject Path: CordovaLib
Running command: /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/gradlew cdvBuildDebug -b /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_648tt8e3eddnib21cv5hmdpsm.run(/Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build.gradle:139)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild
UP-TO-DATE
:preDebugBuild
UP-TO-DATE
:checkDebugManifest
:preReleaseBuild
UP-TO-DATE
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild
UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
UP-TO-DATE
:CordovaLib:compileDebugNdk
UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
UP-TO-DATE
:CordovaLib:generateDebugResValues
UP-TO-DATE
:CordovaLib:generateDebugResources
UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE
:CordovaLib:processDebugManifest
UP-TO-DATE
:CordovaLib:generateDebugBuildConfig
UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources
UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard
UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE
:CordovaLib:processDebugJavaRes
UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders
UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
UP-TO-DATE
:CordovaLib:bundleDebug
UP-TO-DATE
:CordovaLib:preReleaseBuild
UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
UP-TO-DATE
:CordovaLib:compileReleaseNdk
UP-TO-DATE
:CordovaLib:copyReleaseLint
UP-TO-DATE
:CordovaLib:mergeReleaseShaders
UP-TO-DATE
:CordovaLib:compileReleaseShaders
UP-TO-DATE
:CordovaLib:generateReleaseAssets
UP-TO-DATE
:CordovaLib:mergeReleaseAssets
UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles
UP-TO-DATE
:CordovaLib:packageReleaseRenderscript
UP-TO-DATE
:CordovaLib:compileReleaseRenderscript
UP-TO-DATE
:CordovaLib:generateReleaseResValues
UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources
UP-TO-DATE
:CordovaLib:processReleaseManifest
UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig
UP-TO-DATE
:CordovaLib:processReleaseResources
UP-TO-DATE
:CordovaLib:generateReleaseSources
UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard
UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac
UP-TO-DATE
:CordovaLib:processReleaseJavaRes
UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders
UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
UP-TO-DATE
:CordovaLib:bundleRelease
UP-TO-DATE
:prepareComAndroidSupportSupportV132340Library
UP-TO-DATE
:prepareComAndroidSupportSupportV42340Library
UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase1104Library
UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1104Library
UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGcm1104Library
UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesIid1104Library
UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1104Library
UP-TO-DATE
:prepareMeLeolinShortcutBadger1119Library
UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib622DebugLibrary
UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl
UP-TO-DATE
:compileDebugRenderscript
UP-TO-DATE
:generateDebugBuildConfig
UP-TO-DATE
:generateDebugResValues
UP-TO-DATE
:generateDebugResources
UP-TO-DATE
:mergeDebugResources
UP-TO-DATE
:processDebugManifest
UP-TO-DATE
:processDebugResources
UP-TO-DATE
:generateDebugSources
UP-TO-DATE
:incrementalDebugJavaCompilationSafeguard
UP-TO-DATE
:compileDebugJavaWithJavac
UP-TO-DATE
:compileDebugNdk
UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders
UP-TO-DATE
:compileDebugShaders
UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
UP-TO-DATE
:transformClassesWithDexForDebug
UP-TO-DATE
:mergeDebugJniLibFolders
UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug
UP-TO-DATE
:processDebugJavaRes
UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
UP-TO-DATE
:validateSigningDebug
:packageDebug
UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug
UP-TO-DATE
BUILD SUCCESSFUL
Total time: 1.802 secs
Command finished with error code 0: /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/gradlew cdvBuildDebug,-b,/Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,-Pandroid.useDeprecatedNdk=true
Built the following apk(s):
/Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk
No scripts found for hook "before_deploy".
ANDROID_HOME=/Users/dallascaley/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Running command: adb devices
Command finished with error code 0: adb devices
Running adb shell command "cat /proc/cpuinfo" on target 1215fc3807890504...
Running command: adb -s 1215fc3807890504 shell cat /proc/cpuinfo
Command finished with error code 0: adb -s,1215fc3807890504,shell,cat,/proc/cpuinfo
Skipping build...
Built the following apk(s):
/Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk
Using apk: /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk
Package name: com.m2.velexo
Installing apk /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk on target 1215fc3807890504...
Running command: adb -s 1215fc3807890504 install -r /Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk
Command finished with error code 0: adb -s,1215fc3807890504,install,-r,/Users/dallascaley/Sites/scotch-box/velexo-mobile/platforms/android/build/outputs/apk/android-debug.apk
Running adb shell command "input keyevent 82" on target 1215fc3807890504...
Running command: adb -s 1215fc3807890504 shell input keyevent 82
Command finished with error code 0: adb -s,1215fc3807890504,shell,input,keyevent,82
Starting application "com.m2.velexo/.MainActivity" on target 1215fc3807890504...
Running adb shell command "am start -W -a android.intent.action.MAIN -ncom.m2.velexo/.MainActivity" on target 1215fc3807890504...
Running command: adb -s 1215fc3807890504 shell am start -W -a android.intent.action.MAIN -ncom.m2.velexo/.MainActivity
此时脚本会挂起约5分钟,然后在退出之前显示以下内容:
Command finished with error code 0: adb -s,1215fc3807890504,shell,am,start,-W,-a,android.intent.action.MAIN,-ncom.m2.velexo/.MainActivity
LAUNCH SUCCESS
No scripts found for hook "after_run".
[phonegap] completed 'cordova run android --device --verbose --no-telemetry'
答案 0 :(得分:0)
所以,我不知道最初的问题是什么,但我确实让我的应用程序最终加载。我这样做的方法是创建一个全新的hello world应用程序,然后慢慢地将旧应用程序中的所有代码复制到其中,同时手动添加插件并修复问题。