Application installation failed even after reviewing everything clearly - android

Seems my Android studios isn't working as it used to work before.
When I run the emulator, it loads for a bit of time, later it opens the emulator, but the project isn't loading up. I'm receiving strange type of error:
Installation failed with message Invalid File: C:\google-services-master\android...\app\build\intermediates\split-apk\debug\slices\slice_2.apk.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
I had some thoughs maybe the project is broken, so I made a new one. The same problem occurs, I created a new emulator, didn't helped either, rebuilded and cleaned the project and still receiving the same problem.
I've checked these topics:
Installation failed in android studio
Android Studio: Application Installation Failed
Couldn't fix it either.. Idk, maybe I should reinstall Android Studios? But hell yeah, it takes so long to install all the updates..
P.S. The project consumes only 1 layout and 1 imageview.
Everything was working fine until now..

Related

Each time I down load, Android Studio Requesting if I want to unistall the existing application?

I keep getting the same message each time I try to download my app to my tablet. I have gone to my tablet and deleted every app that I have ever built but still get the same error?
Installation failed with message Invalid File:
/home/gary/AndroidStudioProjects/wifi-direct-demo-master1/app/build/intermediates/split-apk/debug/slices/slice_2.apk.
It is possible that this issue is resolved by uninstalling an existing version
of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
I was working on my laptop and have since switched to a company supplied computer, so the /home/gary is my laptop and /home/jpogge is the company computer.
You might have the app still installed for other users. You can't see them among your apps but if you go to Settings/Apps/All, they are at the bottom listed as 'Not installed'. Remove them for all users.
Alternatively, I've also found that a clean build solves the problem; clean project -> rebuild from build menu.

application installation failed error at runtime

I receive the following error every time I try and run my application
I tried all the solutions mentioned here and none of them worked.
The weird thing here is that, I tried to run my application for the first time of the Android Emulator and I got the same error. I never installed the application there, yet I get the same error.
any ideas what might be causing this error?
Please do the followings:
*Clean up your Project(Build/Clean Project)
*Uninstall any previous installations of your application on device(if it is present)
*Restart Android studio
*Restart Android Emulator
If your problem is still there, then try to restart your system

Android Studio stuck while building application

I recently switched from Eclipse to Android Studio because I read that it is now the official IDE for Android application development. I downloaded and installed the latest version (1.0.2) for Windows. When using the program for the first time, I decided to create a test application to see if the program was working correctly. Unfortunately, it was not. Once I clicked the finish button to complete the New Project Wizard, A loading bar showed up that said Gradle: Build. This is where the program gets stuck. There is no error message and it appears that the program is running fine, however the build never actually completes. I am never given my MainActivity.Java class, or my activitymain.xml document. If I click the cancel button, the program freezes and I have to use the TaskManager to kill the program. If I re-enter the program and choose to open an existing project, my project will be there. However, upon trying to open the project, I am greeted with the same Gradle: Build loading bar.. I have been searching for an answer for the last 3 days and nothing has worked. Any help is greatly appreciated!
Things I have tried:
Simply letting the program sit for a while to see if it was actually downloading something and was just really slow. I let it sit for 45+ minutes before killing the program.
Uninstalling and re-installing Android Studio
Restarting my computer
Turning off my firewall (Kaspersky)
Running the program as an administrator
Connecting to a different network
Disconnecting my computer from any networks (to force the program to build in offline mode)
Manually downloading Gradle from the link that Android Studio attempts to use when it gets stuck and telling the program to use that file instead of downloading another one.
(I went to this link https://services.gradle.org/distributions/gradle-2.2.1-all.zip, downloaded the file, unzipped it, went to Gradle settings in Android Studio, checked the Offline work checkbox, and finally set the service directory path to my unzipped Gradle folder.)
Hopefully I have given enough information and made it clear what my problem is. If not please tell me what else I need to explain so I can get this issue resolved. Thanks!
Please note I am working on a 64 bit machine running Windows 8. Also, I use studio64.exe
to run the program.
From the discussion we had in the comments, it does not look like you have your gradle on your windows path.
Please change the below to point to your gradle install:
set GRADLE_HOME=C:\<installation location>\gradle-1.11
set PATH=%PATH%;%GRADLE_HOME%\bin
After this, verify that in the terminal running the following works:
gradle tasks
once you get this working, you will want to run the following in your project:
gradle wrapper
This will produce a .bat file which you can then use to run gradle through the wrapper, letting you support multiple native gradle installations.

Android studio does not compile classes.dex into apk

Every time I try to run my app on an emulator or device, installation fails with an INSTALL_FAILED_DEXOPT error. Examining LogCat and the apk spit out by Android Studio reveals that the apk does not contain any classes.dex file.
Strangely, compiling the project from the command line works properly, and will even get android studio to work for a few builds (although the resulting apk does not work completely).
I have tried EVERYTHING TO GET THIS ERROR TO STOP. Reinstalling AS, reinstalling the SDK, reinstalling the JDK, restarting my PC, recreating projects, nothing helps. This error just won't go away. I really want to be able to use Android Studio and get away from Eclipse, but Google is making that really hard.
Anyone have any ideas?

Failure to install APK [INSTALL_FAILED_DEXOPT] Android Studio

I have tried literally everything to try and rectify this error when trying to deploy an app to an actual android device for debugging but have been unable to solve the matter. Everytime I try to launch I get a failed [INSTALL_FAILED_DEXOPT] error and when checking the logcat it is always because there is no classes.dex in my debug apk.
If I run gradlew.bat clean assembleDebug, there is no difference in the apk size so I'm assuming there is a build error in android studio. I am using android studio beta 0.86 and have tried it on 0.89 with the same result. I have tried build tools for 19.1 to 21 with no result. I have also tried different devices and created a new project (that has never been installed on my devices) and android studio seems to think it needs to be uninstalled first when attempting to deploy.
I have tried switching my device to ART, uninstalling and reinstalling android studio, redownloading the sdk and restarting my computer. NOTHING and I mean NOTHING has worked. I think the problem started after I downloaded the lollipop apis but am not sure. I have tried uninstalling all apps with my package signature on my device but NOTHING works! Not even Project -> Clean Project -> Rebuild
This is extremely frustrating as I cannot debug my apps anymore :/ has anyone had any experience with this error or ways to rectify it?
So turns out that the issue was mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.
UPDATE:
I ran into the problem again after I tried to update my SDK and its tools. Turns out that when you try to do this, the SDK locks the tools folder and then you get an error saying some file couldn't be overridden. When this happened to me, all the build tools were deleted so there were errors in the .dex file created when debuggin my app.
We are using android 2.2 (really old i know) and couldn't find a fix for this error. Eventually we found this bug https://android-review.googlesource.com/#/c/30900/. The only solution for us was to remove some libraries...
I kept having the same problem - manually building worked fine, but Android Studio would not build a proper APK.
The problem was that I started the project on Android Studio and Android Gradle plugin version 2.0-beta2. After updating the Gradle plugin to 2.0-beta6 through a simple build.gradle change, the builds stopped working.
Turns out that, although I installed a beta version of Android Studio, the update checker only checked the stable channel. After setting the updater to check the canary channel as well, I was able to upgrade Android Studio to version 2.0-beta6 and builds continued to work normally.
You can change the update preference in Android Studio settings under Appearance and Behavior -> System Settings -> Updates.
I encountered this error when storage of the device is full. Try to open some space.
Try run these commands
adb reconnect
adb reconnect device

Categories

Resources