问题
I'am developing an android app. before this morning everythings ok when i click 'run' in Android Studio, the IDE will compile my codes and install apk to my devices automatically.but now device will disconnect automatically when IDE install apk, so i try to install apk manually,i got same result,like this:
My Envirement OS:Ubuntu 16.04 Android Studio: Android Studio 3.5 Build #AI-191.8026.42.35.5791312, built on August 9, 2019 JRE: 1.8.0_202-release-1483-b49-5587405 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.15.0-65-generic Android Debug Bridge version 1.0.41 Version 29.0.4-5871666
Is anyone got same error like me? Thanks you.
回答1:
Looks like you are trying to install a debug app with adb. Debug APK file is signed with debug Keystore and wont be installed with adb. You need to sign your app. go to link below, generate a Keystore and build your APK file with that Keystore file. guide to sign your app
Don't lose your Keystore file and passwords and try to protect it because you will need it later for updates.
回答2:
Sometimes installed package meta info resides in app install package which causes to show 'failed to install .apk. simply run adb uninstall com.package command and try to install it again.
回答3:
I started having this issue after upgrading Android 3.6
I first tried everything listed on Android error: Failed to install *.apk on device *: timeout
Many of those suggestions are common and should be tried as well. I had to change cable in the past. reboot devices. uninstall applications. but nothing was working today.
I finally figured I needed to update the SDK toolkits
it is now working fine
来源:https://stackoverflow.com/questions/58688663/adb-install-failed