I imported ApiDemos from android-sdk folder using File/New/Project/Android Project/Create Project Existing Samples. When I tried to run any of them, I got this error:
[2011-06-09 10:03:34 - ApiDemos] Re-installation failed due to different application signatures.
[2011-06-09 10:03:34 - ApiDemos] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-06-09 10:03:34 - ApiDemos] Please execute 'adb uninstall com.example.android.apis' in a shell.
What I am supposed to do ? Thank you !
Delete existing version of Api Demos from emulator. Go to Settings -> Applications -> Manage Applications click on Api Demos and uninstall it.
And then re run Api Demos.
Hope this help!!!
The error is due to the previous running of another android application. When running an Android application, Eclipse has to sign the application by the debug certificate. The existing cert is signed to the previous application and not allowed to install to the new application.
To resolve this problem, you have to uninstall the application by the adb uninstall command.
1. Open the command prompt
2. Go to the SDK directory \android-sdk\platform-tools\
3. Run the command adb uninstall com.android.packagename
4. After that, you can run the application in the Eclipse again.
This works for me like a charm!! Magic!!
Related
I decided to generate even more money and develop my first app for Android. When I want to deploy my app (just the skeleton code from IntelliJ/Android SDK) with one MainActivity I am getting the following error.
The log of the run looks like this.
5/07 21:32:35: Launching app
$ adb install-multiple -r -t
C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_7.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_6.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_8.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_9.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_4.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_5.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_3.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\resources\instant-run\debug\resources-debug.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_0.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_1.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\dep\dependencies.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_2.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\instant-run-apk\debug\app-debug.apk
$ adb shell pm uninstall com.stark.purewallpaper
Unknown failure: Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.stark.purewallpaper
at com.android.server.pm.Settings.getInstallerPackageNameLPr(Settings.java:4671)
at com.android.server.pm.PackageManagerService.getInstallerPackageName(PackageManagerService.java:25342)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:25348)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:21062)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:924)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:25884)
at android.os.Binder.shellCommand(Binder.java:642)
at android.os.Binder.onTransact(Binder.java:540)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3329)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4763)
at android.os.Binder.execTransact(Binder.java:739)
Error while Installing APKs
The event log looks like this.
21:32 Executing tasks: [:app:assembleDebug]
21:32 Gradle build finished in 493 ms
21:32 Failed to finalize session : -118
Things I tried on the phone:
re-enabled dev mode
re-enabled USB debugging
tried different default usb configurations like "picture" or "file" transfer
tried activating "wait for debugger" option
Things I tried in IntelliJ:
deactivated "Instant Run"
installed all SDK tools, including the "Google USB Driver"
cleaned and rebuild the project
IntelliJ can clearly see my device, it even detects the type correctly.
I am on:
Windows 10
IntelliJ 2019.1.1
Newest Android SDK that comes with IntelliJ
I decided to try this on Android Studio 3.4 and I'm getting same error.
I am able to run the app inside the emulator/virtual device but not on my Samsung Galaxy S10+. Any ideas?
If none of the solution mentioned above works, you can turn off the instant run option as shown in the from setting
Try this:
Build > Clean Project
Build > Rebuild Project
Build > Make Project (Ctrl + F9)
Try to use this File > Invalidates cache/restart
Lastly, try to sync project with Gradle file which can be found in the right corner top
I finally, after days, found out what it was. My company forced a security policy on my phone after I configured the e-mail app to receive work mail. After deactivating the policy in security settings I was able to deploy the app without any problems.
Go to your Apps menu from your Android device Settings.
Find your app, probably name is PureWallpaper according to your logs.
Uninstall it.
Then try to install it again.
Explanation:
According to your error logs, it looks like your device has the same app installed but with different signature signed with different keystore.
This was happen to me many times ,
This is just a warning ,It try to say that the app you want to install on your device is already installed on your device ,but the problem is it is signed with different credentials .
For eg:-
their was a release apk of the same app installed on your device and you are trying to install debug apk on same device.
This error also try to say that the that all the data which are saved by that apk will be lost.
Side note:- after clicking OK,sometimes android studio gives me error that it is unable to install but actually it installed.
I am trying to install apk from android studio. Initially I got below error:
So I disable instant run as suggested in many post on stackoverflow like this How To Stop Installation of Multiple Slice APK In Android Studio 2.3.
Now I am getting below error after disabling instant run:
java.io.IOException: An established connection was aborted by the
software in your host machine Error while Installing APK
I have only one instance of android studio running when I got this error.
Android studio version is 3.3.1. What can be cause of above error.
Also I am not able to install apk using adb install command. I am getting message failed to install apk with no detail message.
You can restart Android Studio : File -> Invalidate caches/restart
And i think you install ADB-Idea pluggin to uninstall or clear app data very easy with shortcut.
ADB-Idea pluggin :
Link
So I found out why I was not able to install apk from studio or from adb install command. Issue was due to my pc usb port was blocked by network administrator of our organization as my usb port usage period expired. So if anyone facing issue of not able to install apk and getting error as mentioned in question and no solution working for you than please check if your pc ports are not blocked by your organization network admin. I took approval to use usb port and it is working now.
You have got the first error because of :
You are testing your project_A on a emulator_E
As you had the app project_A, installed on the emulator_E, in previous run.
Now you started the execution of your project_A, again on the emulator_E.
The Android_Studio and emulator_E, both came to know that, the apk is already on the emulator_E, so just, whatever the new changes are, will be synchronised, within the, already available project_A apk, on the emulator_E.
But as the whole process takes some time, you uninstalled the apk of project_A on a emulator_E.
And now project_A on a emulator_E is not there, but Android_Studio tried to synchronised it, which leads you to the ERROR_1
Solution
You are following many approaches, for the same thing.
You are starting your project, project_A on the emulator_E by :-
via ADB INSTALL from the command line too
With Instant Run too
With Instant Run too
And you are not keeping the previous apk as it is there on the emulator_E, after starting the execution too.
Uninstall it from emulator_E, but before you start the execution for emulator_E. Which lead to your Android Studio to some dangerous STATE_A and, Android Studio is not tested by google for such types users
It may seem harsh, and obviously it is not the answer, but this is the exact problem, which is leading you to the such case.
I download an android project source code from github and open it with Android Studio, but when I click the "run app" button, after some while I got this error:
Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error).
In order to proceed, you have to uninstall the existing application.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
And I got this error in the console
$ adb push D:\work\zuoyexitong\third-part-projects\AndroidAudioRecorder\app\build\outputs\apk\app-debug.apk /data/local/tmp/cafe.adriel.androidaudiorecorder.example
$ adb shell pm install -r "/data/local/tmp/cafe.adriel.androidaudiorecorder.example"
pkg: /data/local/tmp/cafe.adriel.androidaudiorecorder.example
Failure [INSTALL_FAILED_DEXOPT]
But I'm sure I didn't install this apk before. And if I click "ok" to let Android Studio to uninstall the app, i got this error
$ adb shell pm uninstall cafe.adriel.androidaudiorecorder.example
Unknown failure (Failure)
Error while Installing APK
My Android Stuido Version is : 2.2.3 .
The project i use is here
My device's android version is 4.1.1 .
My problem looks like this and this , but they can't solve my problem.
So how to solve this problem?
Try turning off Instant Run in Android Studio:
File / Settings / Build, Execution, Deployment / Instant Run / uncheck the top box.
If this allows successful installs, then turn instant run back on, and see if the problem comes back. It did for me - I just hit this issue on a small test program at AS2.4P7. The instant run feature is a light switch -on gives this error (even after refactoring) - off and the app loads OK. If it problem comes back when you turn on instant run again, then file a bug report - Help / Report Instant Run Issue...
This message is because there is an old version of your app installed on the device that has a dex size different from the current one you are trying to install, so you should press OK and proceed!
But I'm sure I didn't install this apk before.
Check if you are using the same package name of another app that is installed on your device [most probably by you]!
check you have space left for app install. Try uninstalling some apps and try this app install.
Is there a way I can just update the apk file after making changes to the android source file in eclipse. I want to be able to do this without actually pressing the Run button in eclipse.
The reason I want this is because - I usually keep the emulator open in the background (since booting it up everytime takes too much time on my slow computer). And when I run the program after a previous run, eclipse just seems to hang up - even after I have stopped the app in the emulator.
So I decided to use the adb install command-line program to install on the emulator, but am unable to get the apk file updated without actually pressing on the run button in eclipse.
Actually, the Eclipse ADT plugin works like you want it to work. Everybody just run emulator once and then pressing RUN button update the application. If you have problems with this post the logcat during the run of your application.
You always can check the Build Automatically option in the Project menu option in Eclipse. Or you can Project->Clean your code, sometimes Eclipse get stuck trying to refresh all projects and dependencies.
You can un-install apk package with command line----
in linux os example:- adb shell pm uninstall -k <package name>
You can leave -k if you don't want to delete data and cache. If this command is failed then use emulator;
open settings in emulator -> apps -> your app and then stop it or un-install with emulator and it is more easy. Options are depend on emulator device.
I got Calculator source code from google's android.git.kernel.org and successfully build the project without problem. But when I launch it in eclipse, I got this
Re-installation failed due to different application signatures.
[2011-08-14 03:37:04 - JvCalculator] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-08-14 03:37:04 - JvCalculator] Please execute 'adb uninstall com.android.calculator2' in a shell.
[2011-08-14 03:37:04 - JvCalculator] Launch canceled!
I don't think I have the application in my emulator. So it's not uninstall/install problem, I think. I suspect that the google's source code has different signature. If so how I can change it? Is there anybody that resolved this issue? Or do I have to build a new project with copy and paste?
Note that when I tried following while connecting emulator,
adb uninstall com.android.calculator2
I got a simple one-word error message "Failure".
"How can I install Calculator (or any app) from the git repository (or from source) to any device that already has it installed?" You can't change the signature because that is a closely guarded secret at Google or (any other app developer). What you can do is change the application's package, with a different package the system will think its a different app.
I had this exact problem. Uninstalling via adb did the trick:
adb -d uninstall org.janeullah.android.healthrecords
Try making a new emulator.
Try cleaning the project.
Had same error, but I was testing the app on a device that had the app already installed (some old version). After uninstalling it worked without renaming the packages or other changes.