Android: Eclipse doesn't pushed new version of app to emulator - android

When developing for Android in Eclipse, the emulator relaunches the old version of the app each time I run the project unless I go through the rather arduous procedure of Settings -> Applications -> Manage applications -> [my application] -> Uninstall -> Ok -> Ok in the emulator.
I had this problem on some projects but not on others when following the tutorials on the Android Developers site, and my friend turns out to have the same problem. Although this has been asked before (here and to some extent here) their problem turned out to be "some extra quotes on one of the xml file" and I can see no such thing in my project. Otherwise people seems to be saying that Eclipse should push the new version. Unfortunately, it doesn't.
I would be grateful for any suggestions.

I had this issue as well, and what i figured out was:
If you are using your device for debugging, then you should launch a debug session, not a run one.
On the other hand, if you want to install an application, or you want to launch a run session directly on your device, the version of your application set in the androidManifest.xml must be greater than the one on your phone.

Try Menu-Project-Clean, Select your project to clean, this will delete everything but the source. Eclipse should re-build automagically if not select Menu-Project-Build Automatically.
Right click your project, Android tools, fix project should automatically fix some unknown error maybe
Double check your xml, an error in a layout could cause your situation. A wrong id for example will not show as an error in eclipse.

Related

Android app not running after splash screen

I would like to contact you with the problem that I switched from Delphi version 10.4 to Alexandria (11.2).
From then on, my Android applications compile and build without error, but after the splash screen they do not start on Android devices, regardless of the Android version. Not even on those that ran without errors before.
I did not change the source code, only the development tool was updated.
Looking around the Internet, others are also complaining about this phenomenon, but I can't find a solution anywhere.
My respectful request would be that if you can suggest some kind of solution, please let me know, because this is why I am standing still and it would be good to move forward.
Thank you in advance for your answers.
Android system libraries have been reset to default.
There are a lot of possibilities. Here are a few steps you can use to troubleshoot this sort of failure.
Always back up your project first. Preferably using source control!
Revert Deployment
In the release notes for 11 Alexandria there is section about updates to the Android Manifest
An older Android Project Might Fail at Run Time or When Debugging
Building an older Android project in the IDE can cause the app to fail
at run time and debug time, with a Java "Class not found error". To
correct the issue, do the following:
Select Project > Deployment.
In the Deployment Manager, click the Revert To Default speed button.
It is the 7th button that looks kind of like "undo". Make sure you select the Android platform.
Test a New Project
Create a new simple project from scratch and see if it will run. Try both Android 32-bit and 64-bit. If it doesn't then there may be something wrong in your SDK Manager (Tools -> Options -> Deployment -> SDK Manager).
Look under Android on all three tabs: SDK, NDK, Java; for any warning symbols. You might need to correct a path or install Android support.
Compare AndroidManifest.template.xml
Take the AndroidManifest.template.xml from the new project you created, and compare it to the one in your project from a previous version. If you haven't modified it then you can just copy the new one over the old one.
Revert Android Libraries
Expand out the Project Manager and the Android platforms to Libraries. Right click and choose Revert System Files to Default.
More Debugging
You can use ADB LOGCAT to see the error on failure. This is super useful. There are GUI wrappers for it, like DeviceLens by Dave Nottage of DelphiWorlds.
Check the code in your form constructor. An exception here can cause a crash like you are describing.
Reboot your phone. I hate how often this fixes things for me. It should be the first thing, but it is usually the last.

Failed to install the Android studio application on my phone [duplicate]

Trying to install app on real device following instructions:- http://developer.android.com/tools/device.html. At end Android Studio giving error:
Session 'app': Error Installing APK
I guess the problem probably can be in my android device(it is chinese Doogee X5). It does not have a given USB Vendor ID in developer docs so I decided to follow instructions with random vendor ID from HTC.
I'm sure there is a way to run application on any android device, but yet I didn't find an answer on how to do that.
I'm running through Linux Ubuntu 14.04 LTS
Edit:
In newer Android Studio versions you can re-sync the project using this button:
For older versions:
Open Gradle window (on the right side in Android Studio) and click on the refresh button.
However it is not a 100% sure fix.
Solutions for other cases:
Open terminal window and type "adb kill-server", then type "adb start-server". Usually after a few hours of inactivity, adb used to disconnect the device. (If you don't have the sdk/platform-tools in the PATH environment variable, then you should open a terminal in that folder)
One tip if these solutions don't help you:
If you open the Event Log window in the right bottom corner of Android Studio, you can see a detailed error message.
Other edge case
If you see this error: INSTALL_FAILED_INVALID_APK:... signatures are inconsistent.
Then unfortunately a gradle refresh isn't enough, you have to go to Build -> Clean Project and then Run again.
Issue with Android emulator
If you want to deploy the APK to an Android Emulator and you see the "Error installing APK" message, your emulator may be frozen and need restart.
Turning off the Instant run removed my error for Androdi Studio 2017.03.03 v2.3
You have to enable Developer options and enable USB Debugging:
Go to the settings menu, and scroll down to "About phone." Tap it.
Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. (If only it were that simple, eh?) Keep on tapping, and poof, you've got the developer settings back.
http://www.androidcentral.com/how-enable-developer-settings-android-42
Inside Developer Options, enable USB Debugging
Try using a different version of Gradle(stable version).
To summarize:
Check your gradle file for debuggable false/true
Invalidate caches & restart
Check your install location
Restart adb
I fix this by delete the build folder then run project again
Make sure that your device is not out of Memory!
I changed my USB port and that fixed it for me.
Make sure that project name doesn't contain special character.
Another possibility may be the USB driver on your PC. In my case, switching from my 3.0 USB port to my 2.0 port fixed the problem.
Ensure you android device has enough memory to install the app. Sometimes it so happens working with multimedia app where the device storage keeps on increasing and you keep wondering about the error.
Therefore, free up some memory and try installing again!
A bit late to the party, but be sure that you are trying to build a proper build variant. It sometimes happens to me that when I update AS, the build variants are totally messed up, so instead of building the "debug" variant I am actually building the "release" variant, which outputs apk to a different location (not to app/build directory, but to app directly) and I get the following error:
The APK file /path/to/file/app.apk does not exist on disk.
Error while Installing APK
To fix this just open the menu in left bottom corner, click on "Build Variants" and select the debug variant (it might have a different name, depending on how many modules/flavors or custom gradle build types you have).
Try to remove the .idea folder and .gradle folder, then click Sync Project with Gradle Files, when the process finished, try to run app again.
Hope it works.
just press Build button from menu bar and then press build app wait for it finished then press build APK and then run your emulator, it will work
Usage of easily changing variable value will often happen in build.gradle(like the Date)
In my case with Android 8.0(Oreo), no one of this solutions worked!
If you have more than 1 user, then you should go to Settings->Applications->All Applications->Find the application and uninstall for all users!
After this steps, it worked!
Just rebuild and clean project, then run project.
This happens because the gradle is not synced with the app. Go to : Tools -> Android -> Sync Project with Gradle files. Re-run and you should be good to go.
Nothing above helped me. The fingerprint dialog did not appear. I checked another android device and the dialog appeared and debug was possible.
So the problem was on device side not on computer side I made reset "to factory settings" on device and this helped me.
I fixed my issue, simply by using :
Build->Clean Project
then
Build->Rebuild Project
I had this same issue and none of the other solutions worked for me.
Although no errors were shown nor expanded upon in my IDE GUI, I opened up a second Android Studio window window with a different project and noticed in the bottom that the "Event Log" showed an error in a different window, but not in the project I had opened. The issue stated was:
Error: INSTALL_FAILED_CONFLICTING_PROVIDER
Which lead me here - Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER :
I had this FileProvider labeled in the manifest:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="myapp.sameonehere.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
Which I had copied from another project and forgotten to rename the 'authorities' String in. After changing it to something unique, it ran without issue.
Make sure you don't have any conflicting authority Strings like in my example.
Also, if no errors are showing up, try opening a second project and see if the "Event Log" shows errors in that location instead.
Uninstall the app, and re-install and it should work!
Go to avd manager and click on Wipe Data of the device you want to run. Worked for me. The size of device on disk will reduce after wiping the data. I hope it helps someone.
You have to enable Developer options and enable USB Debugging:
1:Go to the settings menu, and scroll down to "About phone." Tap it.
2:Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times.
After the third tap, you'll see a playful dialog that says you're four taps away from being a developer.
Keep on tapping, and poof, you've got the developer settings back.
My issue was solved by
Clean --> ReBuild --> Run
and in my case it was because i accidentally deleted the project folder and when i clicked ctrl+z to restore something wrong happened.
My problem was that I didn't accept the connection from the computer after turning on remote debugging. Once I accept the mac address, it went away. Silly mistake, but I didn't see the dialog box the first time. Worth a quick check if the others don't resolve the issue. But likely only a problem the first time you set up a phone.
What worked for me is deleting the app from the emulator (which was an app built from an older commit) and re-running from Android Studio.
It was written above: in my case it was just out of memory on device storage. Add more empty space - and error will disappear
I tried invalidating cache, deleting build folder and gradle sync. Also, I couldn't uninstall because the app is not visible on device. So I tried uninstalling through ADB and it worked.
adb uninstall <package_name>
If you are using android emulator, try changing a device.

Session 'app': Error Installing APK

Trying to install app on real device following instructions:- http://developer.android.com/tools/device.html. At end Android Studio giving error:
Session 'app': Error Installing APK
I guess the problem probably can be in my android device(it is chinese Doogee X5). It does not have a given USB Vendor ID in developer docs so I decided to follow instructions with random vendor ID from HTC.
I'm sure there is a way to run application on any android device, but yet I didn't find an answer on how to do that.
I'm running through Linux Ubuntu 14.04 LTS
Edit:
In newer Android Studio versions you can re-sync the project using this button:
For older versions:
Open Gradle window (on the right side in Android Studio) and click on the refresh button.
However it is not a 100% sure fix.
Solutions for other cases:
Open terminal window and type "adb kill-server", then type "adb start-server". Usually after a few hours of inactivity, adb used to disconnect the device. (If you don't have the sdk/platform-tools in the PATH environment variable, then you should open a terminal in that folder)
One tip if these solutions don't help you:
If you open the Event Log window in the right bottom corner of Android Studio, you can see a detailed error message.
Other edge case
If you see this error: INSTALL_FAILED_INVALID_APK:... signatures are inconsistent.
Then unfortunately a gradle refresh isn't enough, you have to go to Build -> Clean Project and then Run again.
Issue with Android emulator
If you want to deploy the APK to an Android Emulator and you see the "Error installing APK" message, your emulator may be frozen and need restart.
Turning off the Instant run removed my error for Androdi Studio 2017.03.03 v2.3
You have to enable Developer options and enable USB Debugging:
Go to the settings menu, and scroll down to "About phone." Tap it.
Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. (If only it were that simple, eh?) Keep on tapping, and poof, you've got the developer settings back.
http://www.androidcentral.com/how-enable-developer-settings-android-42
Inside Developer Options, enable USB Debugging
Try using a different version of Gradle(stable version).
To summarize:
Check your gradle file for debuggable false/true
Invalidate caches & restart
Check your install location
Restart adb
I fix this by delete the build folder then run project again
Make sure that your device is not out of Memory!
I changed my USB port and that fixed it for me.
Make sure that project name doesn't contain special character.
Another possibility may be the USB driver on your PC. In my case, switching from my 3.0 USB port to my 2.0 port fixed the problem.
Ensure you android device has enough memory to install the app. Sometimes it so happens working with multimedia app where the device storage keeps on increasing and you keep wondering about the error.
Therefore, free up some memory and try installing again!
A bit late to the party, but be sure that you are trying to build a proper build variant. It sometimes happens to me that when I update AS, the build variants are totally messed up, so instead of building the "debug" variant I am actually building the "release" variant, which outputs apk to a different location (not to app/build directory, but to app directly) and I get the following error:
The APK file /path/to/file/app.apk does not exist on disk.
Error while Installing APK
To fix this just open the menu in left bottom corner, click on "Build Variants" and select the debug variant (it might have a different name, depending on how many modules/flavors or custom gradle build types you have).
Try to remove the .idea folder and .gradle folder, then click Sync Project with Gradle Files, when the process finished, try to run app again.
Hope it works.
just press Build button from menu bar and then press build app wait for it finished then press build APK and then run your emulator, it will work
Usage of easily changing variable value will often happen in build.gradle(like the Date)
In my case with Android 8.0(Oreo), no one of this solutions worked!
If you have more than 1 user, then you should go to Settings->Applications->All Applications->Find the application and uninstall for all users!
After this steps, it worked!
Just rebuild and clean project, then run project.
This happens because the gradle is not synced with the app. Go to : Tools -> Android -> Sync Project with Gradle files. Re-run and you should be good to go.
Nothing above helped me. The fingerprint dialog did not appear. I checked another android device and the dialog appeared and debug was possible.
So the problem was on device side not on computer side I made reset "to factory settings" on device and this helped me.
I fixed my issue, simply by using :
Build->Clean Project
then
Build->Rebuild Project
I had this same issue and none of the other solutions worked for me.
Although no errors were shown nor expanded upon in my IDE GUI, I opened up a second Android Studio window window with a different project and noticed in the bottom that the "Event Log" showed an error in a different window, but not in the project I had opened. The issue stated was:
Error: INSTALL_FAILED_CONFLICTING_PROVIDER
Which lead me here - Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER :
I had this FileProvider labeled in the manifest:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="myapp.sameonehere.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
Which I had copied from another project and forgotten to rename the 'authorities' String in. After changing it to something unique, it ran without issue.
Make sure you don't have any conflicting authority Strings like in my example.
Also, if no errors are showing up, try opening a second project and see if the "Event Log" shows errors in that location instead.
Uninstall the app, and re-install and it should work!
Go to avd manager and click on Wipe Data of the device you want to run. Worked for me. The size of device on disk will reduce after wiping the data. I hope it helps someone.
You have to enable Developer options and enable USB Debugging:
1:Go to the settings menu, and scroll down to "About phone." Tap it.
2:Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times.
After the third tap, you'll see a playful dialog that says you're four taps away from being a developer.
Keep on tapping, and poof, you've got the developer settings back.
My issue was solved by
Clean --> ReBuild --> Run
and in my case it was because i accidentally deleted the project folder and when i clicked ctrl+z to restore something wrong happened.
My problem was that I didn't accept the connection from the computer after turning on remote debugging. Once I accept the mac address, it went away. Silly mistake, but I didn't see the dialog box the first time. Worth a quick check if the others don't resolve the issue. But likely only a problem the first time you set up a phone.
What worked for me is deleting the app from the emulator (which was an app built from an older commit) and re-running from Android Studio.
It was written above: in my case it was just out of memory on device storage. Add more empty space - and error will disappear
I tried invalidating cache, deleting build folder and gradle sync. Also, I couldn't uninstall because the app is not visible on device. So I tried uninstalling through ADB and it worked.
adb uninstall <package_name>
If you are using android emulator, try changing a device.

An internal error occurred during: "Launching Project". java.lang.NullPointerException

My android project was compiling well but suddenly it stopped launching. Then I tried to launch other projects from Project Explorer and all project threw same exception:
An internal error occurred during: "Launching Project". java.lang.NullPointerException
But console always shows everything is normal.
Android Launch!
adb is running normally.
Performing com.mmcolrev.LoginActivity activity launch
Here's screenshot of error.
If anyone face this problem, first keep in mind that error is not in your code but due to some internal issue in eclipse ADT. I don't know exact problem but luckily found way to solve it. If you ever encounter this error follow steps below:
Exit Eclipse.
Go to Android workspace.
Locate .metadata folder(make sure you set hidden folder visibility on).
Delete .metedata folder.
Start Eclipse(you will notice project explorer is empty, don't panic) and import all your projects.
Removing Gen/R.java and restarting eclipse, worked for me.
This is a cause of AVD is not picked because you might delete it or it is not picked up correctly ... in other words deployment target is not specified or it has some problem in picking up a device.
To Resolve this:
Right click your project and choose "Properties"
From "Run/Debug" Settings, Highlight over your application name then hit "Edit..."
In "Target" tab, you have to choose a virtual device to be picked automatically under option named "Automatically pick compatible device..."
to avoid such prompt you could choose the first option "Always prompt to pick device" that will ask you everytime to choose or pick a device inside which you want to run your app.
If it still not working restart Eclipse
One cause of this issue for me was that I had been updating my Android Tools with the installer. It was running in the background doing all its updates. I had forgotten about it since I had told it to do the work in the background. Then realized it had finished its work and needed a restart after the installation.
Once the upgrade / installation was done and the IDE was restarted, the Eclipse environment went back to behaving as normal.
I had the same issue.
Non of my project in the workspace would run and I would get the same message "An internal error occurred..." and details would just say something about a Nullpointer. This happend after I did some updates and all projects in the workspace started giving the same issue.
It took me some time to find the problem:
When I go to configuration of the project (Run Configuration...) I could see that "Project" in the configuration settings was empty. So my update removed the projects from the configurations. Once I put back the project in the configuration again problem was gone.
In my case, it was because I was running it with Debug As -> Android Native Application, while the emulator was closed (I debugging on the emulator, not on a real phone).
I needed to first start the emulator using Debug As -> Android Application, after which Debug As -> Android Native Application will work.
Close the emulator and the error re-appears. My conclusion is that Debug As -> Android Native Application won't work unless the emulator is already started.
I had this error with an NDK project (eclipse mars, loaded an ant project) everytime i tried to lauch on the device (google tango yellowstone) using Debug As -> Android Native Application. Note, that i switched the device and changed a dependent library since the last successful build.
When i tried Debug As -> Android Application i got this message:
Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data!
Do you want to uninstall?
clicking OK here solved the issue, so Debug As -> Android Native Application also worked again.
I had the same issue all of a sudden. This only happened when I ran in Debug mode, and for me what fixed it was... Run -> Remove All Breakpoints. Then I could add them back, and it ran in debug mode fine.
To resolve this issue, I just remove the old JRE System Library and point to the new JRE System Library.
Got the similar issue after update the project able to procced.
Right click on the project -->Maven --> Update Project
In My case issue was java version in updating it to correct (11->1,8) and doing maven update helped me
ISSUE : Error: Could not find or load main class com.pluralsight.fundamentals.FundamentalsApplication
Caused by: java.lang.ClassNotFoundException: com.pluralsight.fundamentals.FundamentalsApplication
ANSWER:
Open cmd (Command prompt)
Check java version (java -version)
Open POM.xml and check java version there
You are getting this error, that means java version is mismatched.
Change the java version in POM.xml (example: if java 11 , add it as 1.11 in pom.xml file)
Example: <java.version>1.11</java.version>
Update Maven by right click on the on the project in eclipse
Now it will work and the error will be vanished :)

Application updates in emulator from Eclipse

In Eclipse, when I modify my Android application and I launch it in the emulator, Eclipse first asks me if I want to save the modified files and I answer "yes". So far, everything seems normal.
The problem is that, in the console window, Eclipse says : "Application already deployed. No need to reinstall.". And the application is not updated in the emulator.
Any idea of a reason which could explain this behaviour?
I can add that the "Build automatically" option is set.
After some more investigations, despite the "Build automatically" option set, I'm not sure the build is executed. How can I check if a new "apk" file has been created?
The problem seems to be much bigger : when I create with the wizard a brand new Android application, in the error window, Eclipse displays the following error : "failed to load properties files for project". The resource file (R) is not generated and, in the marker window, I have one error for each line of code containing a reference to the resource file.
With a complete re-installation of both Eclipse and the Android SDK manager, the problem seems to be solved.
Try re-installing the app.
Also, always exit the app in the emulator before updating it. It should work by itself, but it can be weird sometimes.
Just uninstall the application in your emulator and red-deploy it.

Categories

Resources