【问题标题】:success Build release APK but cant install成功构建发布APK但无法安装
【发布时间】:2017-09-09 15:35:36
【问题描述】:
D:\06 ANDROID\hwacademy2 - 复制\www>Ionic build android --release 运行命令:"C:\Program Files\nodejs\node.exe" "D:\06 ANDROID\hwacademy2 - Copy\hooks\after_prepare\010_add_platform_class.js" "D:\06 ANDROID\hwacademy2 - Copy" 添加到正文类:platform-android 运行命令:cmd "/s /c ""D:\06 ANDROID\hwacademy2 - Copy\platforms\android\cordova\build.bat" --release"" ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102 运行: D:\06 ANDROID\hwacademy2 - Copy\platforms\android\gradlew cdvBuildRelease -b D:\06 ANDROID\hwacademy2 - Copy\platforms\android\build.gradle -Dorg.gradle.daemon=true :preBuild :preReleaseBuild :checkReleaseManifest :CordovaLib:compileLint :CordovaLib:copyReleaseLint 最新 :CordovaLib:mergeReleaseProguardFiles 最新 :CordovaLib:preBuild :CordovaLib:preReleaseBuild :CordovaLib:checkReleaseManifest :CordovaLib:prepareReleaseDependencies :CordovaLib:compileReleaseAidl 最新 :CordovaLib:compileReleaseRenderscript 最新 :CordovaLib:generateReleaseBuildConfig 最新 :CordovaLib:generateReleaseAssets 最新 :CordovaLib:mergeReleaseAssets 最新 :CordovaLib:generateReleaseResValues 最新 :CordovaLib:generateReleaseResources 最新 :CordovaLib:packageReleaseResources 最新 :CordovaLib:processReleaseManifest 最新 :CordovaLib:processReleaseResources 最新 :CordovaLib:generateReleaseSources 最新 :CordovaLib:compileReleaseJava 最新 :CordovaLib:processReleaseJavaRes 最新 :CordovaLib:packageReleaseJar 最新 :CordovaLib:compileReleaseNdk 最新 :CordovaLib:packageReleaseJniLibs 最新 :CordovaLib:packageReleaseLocalJar 最新 :CordovaLib:packageReleaseRenderscript 最新 :CordovaLib:bundleRelease 最新 :prepareAndroidCordovaLibUnspecifiedReleaseLibrary 最新 :preDebugBuild :CordovaLib:copyDebugLint 最新 :CordovaLib:mergeDebugProguardFiles 最新 :CordovaLib:preDebugBuild :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl 最新 :CordovaLib:compileDebugRenderscript 最新 :CordovaLib:generateDebugBuildConfig 最新 :CordovaLib:generateDebugAssets 最新 :CordovaLib:mergeDebugAssets 最新 :CordovaLib:generateDebugResValues 最新 :CordovaLib:generateDebugResources 最新 :CordovaLib:packageDebugResources 最新 :CordovaLib:processDebugManifest 最新 :CordovaLib:processDebugResources 最新 :CordovaLib:generateDebugSources 最新 :CordovaLib:compileDebugJava 最新 :CordovaLib:processDebugJavaRes 最新 :CordovaLib:packageDebugJar 最新 :CordovaLib:compileDebugNdk 最新 :CordovaLib:packageDebugJniLibs 最新 :CordovaLib:packageDebugLocalJar 最新 :CordovaLib:packageDebugRenderscript 最新 :CordovaLib:bundleDebug 最新 :prepareComAndroidSupportSupportV132340库 最新 :prepareComAndroidSupportSupportV42400库 最新 :prepareComGoogleAndroidGmsPlayServicesBase961Library 最新 :prepareComGoogleAndroidGmsPlayServicesBasement961Library 最新 :prepareComGoogleAndroidGmsPlayServicesGcm961Library 最新 :prepareComGoogleAndroidGmsPlayServicesIid961Library 最新 :prepareComGoogleAndroidGmsPlayServicesTasks961Library 最新 :prepareReleaseDependencies :compileReleaseAidl 最新 :compileReleaseRenderscript 最新 :generateReleaseBuildConfig 最新 :generateReleaseAssets 最新 :mergeReleaseAssets 最新 :generateReleaseResValues 最新 :generateReleaseResources 最新 :mergeReleaseResources :processReleaseManifest 最新 :processReleaseResources :generateReleaseSources :compileReleaseJava 最新 :lintVitalRelease :compileReleaseNdk 最新 :preDexRelease 最新 :dex 发布 最新 :processReleaseJavaRes 最新 :packageRelease :assembleRelease :cdvBuildRelease 构建成功 总时间:10.174 秒 构建了以下 apk: D:\06 ANDROID\hwacademy2 - Copy\platforms\android\build\outputs\apk\android-release-unsigned.apk D:\06 ANDROID\hwacademy2 - 复制\www>

我有什么想念的 :(

【问题讨论】:

  • 如果您的手机上已经安装了应用程序,请将其删除,然后尝试安装发布版本
  • 我手机中的应用程序已卸载。然后我在手机中安装了我的应用程序app-release-unsigned.apk,但我不能,并显示错误对话框parse error there was a problem parsing the package
  • 如果您的应用未签名,则需要对应用进行签名。然后您的问题将得到解决。 ionicframework.com/docs/v1/guide/publishing.html
  • 好的,谢谢老哥,我会努力的

标签: android mysql cordova


【解决方案1】:

您可以使用以下命令安装并查看 App 的调试版本:

ionic cordova build android(即没有 Release 标志 --release )

如果您想安装并查看您的应用的发布版本,则需要使用密钥对您的应用进行签名。

第 1 步:生成您的私钥(如果有,则放弃此步骤):

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

第 2 步:签署您的 APK

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.jks android-release-unsigned.apk my-alias

第 3 步:使用 Zipalign 优化您的 Apk

zipalign -v 4 android-release-unsigned.apk HelloWorld.apk

请参考此链接:https://ionicframework.com/docs/intro/deploying/(Android 部分)

【讨论】:

  • 我已经完成了第一步,但是当我执行第二步时。 Enter Passphrase for keystore: jarsigner: unable to open jar file: android-release-unsigned.apk
  • 检查您在尝试此命令的位置是否有“android-release-unsigned.apk”。另请检查您是否输入了正确的密钥库密码。
  • 哦,非常感谢Lokkeshwaran,你是对的,我写错了位置。我的问题解决了
【解决方案2】:

生成的 APK 是未签名的 (app-release-unsigned.apk)。您只能在模拟器而非物理设备上安装未签名的 APK。

BUILD SUCCESSFUL

这意味着APK已经构建,它将位于这里:

Copy\platforms\android\build\outputs\apk\android-release-unsigned.apk

然后通过终端运行它(如果是 mac):

adb install PASTEHEREYOURPATH.apk

生成的 APK 是未签名的 (app-release-unsigned.apk)。您只能在模拟器而非物理设备上安装未签名的 APK。

【讨论】:

  • 是的,你的权利,然后我把那个apk复制到我的手机上,我想安装,但我不能。你知道为什么,请帮帮我
  • 当您尝试安装 apk 时显示的错误/消息是什么,请确保在 android 手机上启用了调试。您还可以通过键入以下命令检查设备是否已连接:adb devices
  • 显示的错误是解析错误 there was a problem parsing the package.
  • 生成的 APK 是未签名的 (app-release-unsigned.apk)。您只能在模拟器而不是物理设备上安装未签名的 APK。您需要在未签名版本之前生成已签名的 APK。
  • 哦,谢谢@Luis Ferraiolo。但如何。如果我想在我的手机中安装我的应用程序physical device ?? 我该怎么办?
猜你喜欢
  • 1970-01-01
  • 2018-03-31
  • 1970-01-01
  • 1970-01-01
  • 2020-09-11
  • 2013-07-16
  • 2020-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多