Android App is not installing in emulator or mobile - android

I am new to android. I am doing one app in that I used older version code(4.4) which is already available as project. I imported that project as module and added dependencies in my module "app". No errors are present at compile time or run time. It showing build successful. But when I am trying to install that apk file it was showing app not installed. It was not installing either in emulator or mobile. I thought that because of version difference so I changed the older version to newer version in manifest file and build.gradle file. After that also app was not installing. Can anybody help me why I am facing this problem.I am struggling from yesterday with this issue. Please help me..
I will be thankful.

Try running it via a gradle task.

Related

Android Studio: more info about "Error installing app"

When trying to run the app on the device, I'm facing the following issue:
I the Event Log, there is the same message:
Where can I find more info about the error?
Might work if you Clean the project or rebuild the project and if you launching in emulator uninstall from the emulator or from mobile.
UPDATE:
i think there will be no more information about the error...
It's our common mistakes.
As per my knowledge about this issue there can be a few reasons for that:
First is that your app is already installed with the same package
name but with different certificate, To resolve this check if your
phone has that app already installed then uninstall it and try to
install new one.
The second reason can be that you are trying to install the
application that has minimum SDK version higher than the Android
version of device. To solve this make sure that the minimum SDK
version defined in your project's "build.gradle" is lower than the
Android version of your device.
Turning off the Instant run removed error for Android Studio 2.3.
sometimes project location contained the special character.
Example: E:\Android_Projects\T&PUIET,KUK\app\build\outputs\apk\app-debug.apk
close android studio > rename folder containing the special character(here T&PUIET,KUK ) > restart android studio.
Hope it will help!

ARCore project has no gradle file in Android studio

I downloaded ARCore project and edited the project to run on older devices than Android 7.0 by following some online tutorial that simply editing the manifest file minsdkversion. Then I decompiled the code and signed it with my own debug keys. But all I see is a project without gradle and I am confused with everything at this point.Here is a screenshot of my whole project and gradle settings.
And when I try to run the project, I get this.
So my question is, where is Gradle file? Has anyone tried it and run into this kind of issues?
Do know for grale, but the error you get is the TestRunner, that runs the unit tests, this is not the main application launcher.

Getting error "The package appears to be corrupt" while installing apk file

I am having a weird problem.I got this error after I updated Android Studio from 2.3.3 to 3.0..The problem is when I try to install apk file it says
App not installed.
The package appears to be corrupt.
I have tried generating apk in both debug and release version and tried to install but whenever I install apk it show the same message..
When I run the android project from android studio it is working.
May be the gradle problem but couldn't fix it.
Please help
After searching a lot I found a solution:
Go to Build-> Build Apk(s).
After creating apk you will see a dialog as below.
Click on locate and install it in your phone
Enjoy
As I got this case at my own and the answers here didn't help me, my situation was because of I downgraded the targetSdkVersion in gradle app module file from 24 to 22 for some reason, and apparently the apk doesn't accept another one with downgraded targetSdkVersion to be installed over it.
So, once I changed it back to 24 the error disappeared and app installed correctly.
When you are releasing signed apk , please make sure you tick both v1 and v2 in signature versions
See below screenshot for more info
This is weird. I don't know why this was happening with me while generating signed apk but below steps worked for me.
Go to file and select invalidate caches/restarts
After that go to build select clean project
And then select Rebuild project
That's it.
In my case; If you receive this error while updating your application, It may be because of the target SDK version. In such case you will receive this error on logs;
"Package com.android.myapp new target SDK 22 doesn't support runtime permissions but the old target SDK 23 does"
This is because your previous aplication was build with a higher version of sdk. If your new app was build with 22 and your installed application was build with 23, you will get The package appears to be corrupt error on update.
In my case, the target phone had the app already installed, but in a "disabled" state. So the user thought it was already uninstalled, but it wasn't. I went to the main app list, clicked on the "disabled" app, uninstalled it, and then the APK would go on.
Running a direct build APK will work. But make sure you uninstall any previously installed package of the same name.
In my case by making build, from Build> Build apks, it worked.
None of the answer is working for me.
As the error message is package corrupt , I will have to run
adb uninstall <package name>
Run app again / use adb install
In my case, I had a problem with my module level build.gradle file.
I somehow had removed the line
compileSdkVersion 32
from the file.
This didn't prompt any issue during the build time but only when installing which is where "The package appears to be corrupted" line occurred.
Adding the line back solved my issue.
Please re-check your build.gradle and AndroidManifest for any anamolies since the corrupt message is very ambiguous and hard to debug the exact cause for the issue.
By version number, I mean the versionCode in the app/build.gradle file
The Scenario:
I have an APK installed. Its version number is 152430.
I was trying to install a new APK (by downloading the new APK file) and updating the existing app. The New APK was having version number : 152427
Since the New APK was having version number less than the already installed APK, it was throwing this error.
The solution:
The version number needs to be higher than the installed APK version.

Gradle sync failed

I am completely newbie for Android studio and Android development. Any help would grateful. I am using Android Studio version 2.3.3.
After I created a project I am getting below error.
Your latest installation of android studio 2.3+ doesn't have the dependencies , so you need to download it
1.) Connect to internet
2.) Run gradle synch or run your program
3.) Let the gradle download these dependencies
Note : it will be a one time process and will not be required for other projects
I had the same experience. I just used VPN and then let the gradle download dependencies(by clicking on sync button in build.gradle).For me it wasn't needed to change any proxy settings in android studio.
Thanks all for your quick response!!
To my surprise this has started working connecting from personal internet. Still wondering why it was not working with office network!!

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