如何修复Android Studio中的INSTALL_FAILED_INVALID_APK错误? [英] How to fix INSTALL_FAILED_INVALID_APK error in Android Studio?

查看:4508
本文介绍了如何修复Android Studio中的INSTALL_FAILED_INVALID_APK错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Android Studio更新为3.6.1,从而还将gradle插件更新为3.6.1,并将gradle包装器更新为5.6.4

I have recently updated my Android Studio to 3.6.1, thereby also updating gradle plugin to 3.6.1 and the gradle wrapper to 5.6.4

运行调试版本时,我不断收到此错误

When running the debug build, I keep getting this error

Install failed: The application could not be installed: 
INSTALL_FAILED_INVALID_APK 
The APKs are invalid. 

  • 我已经检查了我的包和applicationId,它是一样的
  • 我尝试在清单<application>标记上使用android:extractNativeLibs="true",但仍然无法正常运行
  • 继续清洁和重建仍然无法正常工作
  • 无效的缓存,已删除的.gradle,idea和构建文件,但仍然无效
  • 我还在gradle.properties文件org.gradle.caching=false上使用了此功能,但仍然无法正常工作 我检查了idea.log文件,这是它的意思:
    • I have checked my package and applicationId and it is the same
    • I tried using android:extractNativeLibs="true" on the manifest <application> tag and it is still does not work
    • Kept on cleaning and rebuilding still doesn't work
    • Invalidated caches, deleted .gradle, idea, and build files and it still does not work
    • I have also used this on gradle.properties file org.gradle.caching=false but still does not work I checked the idea.log file and here is what it is saying:
    • 2020-03-22 00:49:04,191 [4654427]   INFO - ild.invoker.GradleBuildInvoker - Gradle build finished in 1 m 37 s 411 ms 
      2020-03-22 00:49:04,213 [4654449]   INFO - ools.idea.run.tasks.DeployTask - Installing application: PACKAGE_NAME 
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675813ms TRC_BEG [12861][12861] : installer 
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675814ms TRC_BEG [12861][12861] : Command Dump 
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675814ms TRC_BEG [12861][12861] : get process ids 
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675872ms LOG_ERR [12861][12861] : Could not get package user id: /system/bin/run-as: unknown package: PACKAGE_NAME 
      
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675874ms TRC_END [12861][12861] :  
      2020-03-22 00:49:04,451 [4654687]   INFO - a.run.tasks.AbstractDeployTask - 20675874ms TRC_BEG [12861][12861] : retrieve_apk_path 
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675874ms TRC_BEG [12861][12861] : apk_path_via_cmd_package_dump 
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675923ms TRC_END [12861][12861] :  
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675923ms TRC_END [12861][12861] :  
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675923ms LOG_ERR [12861][12861] : Could not find apks for package: PACKAGE_NAME 
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675923ms TRC_END [12861][12861] :  
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - 20675923ms TRC_END [12861][12861] :  
      2020-03-22 00:49:04,452 [4654688]   INFO - a.run.tasks.AbstractDeployTask - DUMP_UNKNOWN_PACKAGE 
      2020-03-22 00:49:04,967 [4655203]   INFO -            #com.android.ddmlib - Created install session 969164047 with options -r -t -S 14667707 
      2020-03-22 00:49:04,967 [4655203]   INFO -            #com.android.ddmlib - Uploading APK C:\Projects\PROJECT_FOLDER\source\PROJECT_NAME\app\build\outputs\apk\debug\app-debug.apk to session 969164047 
      2020-03-22 00:49:08,055 [4658291]   INFO - WindowsPerformanceHintsChecker - Windows Defender status: NONE_EXCLUDED; projectDirExcluded? false 
      2020-03-22 00:49:17,686 [4667922]   WARN -            #com.android.ddmlib - Failed to commit install session 969164047 with command cmd package install-commit 969164047. Error: INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/PACKAGE_NAME -d9UfJVvKMP9-OA81TwCVvQ==: Package /data/app/PACKAGE_NAME -d9UfJVvKMP9-OA81TwCVvQ==/base.apk code is missing 
      2020-03-22 00:49:17,687 [4667923]   WARN - a.run.tasks.AbstractDeployTask - Install failed: The application could not be installed: INSTALL_FAILED_INVALID_APK The APKs are invalid. 
      2020-03-22 00:49:17,689 [4667925]   INFO - run.AndroidLogcatOutputCapture - stopAll() 
      2020-03-22 00:49:21,408 [4671644]   INFO - rationStore.ComponentStoreImpl - Saving appEditorColorsManagerImpl took 12 ms 
      

      *请注意,我用PACKAGE_NAME和项目名称替换了程序包名称

      *Take note I replaced my package name with PACKAGE_NAME and project names

      我没有其他选择了.最糟糕的情况是,我将降级gradle和gradle包装器,甚至是Android Studio,我故意将其降级,因为它是倒退的

      I have run out of options. Worst case is I will downgrade gradle and gradle wraper and even Android Studio, which I deliberately hate as it is a step backwards

      推荐答案

      我尝试更新Android Studio,但仍然收到INSTALL_FAILED_INVALID_APK错误.然后我更新了Firebase依赖关系,但仍然无济于事

      I tried updating the Android Studio but it still get the INSTALL_FAILED_INVALID_APK error. Then I updated the firebase dependencies and still to no avail

      有趣的是,它在我拥有的另一个项目上运行顺利.导致我检查它们之间的依赖关系有所不同,并意识到唯一的主要依赖关系是AppDynamics gradle插件

      Interestingly though, it worked smoothly on another project that I have. Which led me to check which dependencies they differ in and realized that the only major dependency is the AppDynamics gradle plugin

      我删除了AppDynamics工具,它起作用了!我假设甚至在以前,gradle中的AppDynamics工具还是导致应用程序无法正常运行的原因.我已经确认这是AppDynamics插件的问题.请参阅参考链接: https://community.appdynamics.com/t5/End-User-Monitoring-EUM/AppDynamic-EUM-setup-for-Android-Cordova-project/td-p/38864

      I remove the AppDynamics instrumentation and it worked! I am assuming that even before, the AppDynamics instrumentation in gradle was the cause that prevented the app from running properly. I have confirmed it is an issue with the AppDynamics plugin. See link for reference: https://community.appdynamics.com/t5/End-User-Monitoring-EUM/AppDynamic-EUM-setup-for-Android-Cordova-project/td-p/38864

      同时,我将降级直到AppDynamics提供修复程序

      For the meantime, I will be downgrading until AppDynamics provides a fix

      这篇关于如何修复Android Studio中的INSTALL_FAILED_INVALID_APK错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆