App installation failed when transfered code - android

So i started my project on Mac OS and than with USB i transfered to MacOS, using same version of Android studio, but on Mac it doesn't want to run i tried to delte gradle and idea folders build a gradle and all but no success. The error i get is Application Installation Failed:
Installation failed with message Invalid File: /Users/myuser/Code/App/E:\Android\apps\build\intermediates\split-apk\debug\slices\slice_2.apk
Do you want to uninstall this existing application?
So as it looks like its picking up my Windows things from somewhere any idea how i can fix this?

Just Clean & Rebuild the project.

So i just run: ./gradlew clean and disabled instant run and its working now.

Related

Flutter error: Unable to locate gradlew script. Check if bat file exists or the android folder is readable

I've been trying to fix this error since a week now.Somebody please help me fix this...
I have installed flutter and its working fine.
Installed Android Studio 3.6 and also downloaded Android SDK and other tools.(No errors when i execute flutter doctor)
However when i am trying to run the sample first flutter app on my real device (Lenovo Vibe K5 plus android 5.1.1) i get the following error
Unable to locate gradlew script. Please check that C:\Users\...\android\gradlew.bat exists or that C:\Users\...\app1\android can be read.
And when i run project for the first time i get this :
Gradle task assembleDebug failed with exit code -1
What is the problem? How do i fix this?
i think you deleted .gradle file,
you may need to uninstall each and every file related to android studio and install it again.

Android Studio Fails with: "File was deleted, but previous version not found in cache"

I had a project on Android Studio which was working. But after I ran
git pull and then git reset --hard and tried to run it again, build failed with the message:
File 'com.android.builder.files.ZipCentralDirectory#412e039a' was deleted, but previous version not found in cache
Build -> Clean Project fixed my problem.
Go to Task Manager
Search for any instances of OpenJDK or java in task manager click and End Task
Run flutter clean in IDE
The Reason was Flutter Clean cant delete the build while the Application is still running in the Background process, u have to close it and run.
I also faced the same issue. it occurs when you run> flutter clean command that actually did't clean all the files inside build directory of your project, and causes the issue.
So the simple solution is, delete your build directory manually. If it alerts "File in Use" dialogue then simple do the following steps
open the run command with shortcut Window+R
type resmon.exe it will open the resource monitor
click on "CPU" tab
click on "Associated handles" and type build in search bar
right click on java.exe and end process
restart your IDEA and run your project the problem is solved
An alternative way to fix this issue is to run flutter clean.
You mentioned you are using android studio, go to your terminal inside android studio and then run the above mentioned command.
After the above command was executed then run your app again.
This simple solution worked for me !
Using Android Studio 3.6.2 for a Flutter project there is no 'Build -> Clean' unless you 'Open Android module in Android studio'. Then there is a 'Build -> Clean Project'.
An alternative as mentioned above is to open the terminal in the project where you may Debug your application and run 'flutter clean'.
For me the latter is better since I typically only open the Flutter android module when I want to build a release of my app.
Open Android module in Android studio
run success
execute ‘Build -> Clean’
close Android module in Android studio
run flutter project again

Flutter : Several variant outputs are configured to use the same file name

I am just trying to run the first app and this is what happens:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Several variant outputs are configured to use the same file name "resources-debug.ap_", filters : MAIN:MAIN
Please try flutter clean and rebuild.
I got the same error while trying to integrate FCM into my application.. The problem is in the older build file.. i.e as we are editing our Manifest file we need to rebuild the project so..
flutter clean
flutter run
Make sure to do gradle sync if the problem persist..
It solved the problem for me..
Close and reopen IDE
flutter clean
flutter run
just log out from current windows session and then do flutter clean and after run your project. that will solve the problem.
If flutter clean doesn't work, then delete the Android folder, then run flutter clean and run the app... Make sure you have an android emulator or device connected as your run device, this will bring a prompt asking you to enable android for your project then just click yes.
You can also uninstall the app from your emulator or android device before you run it again, but make sure its uninstalled on all profiles of your device.
this error also appear when you mistakly disable the app and try to debug same app again.So go to applications and enable it again to resolve the issue.Thanks
remove pubspec.lock
flutter clean
flutter run

Ionic 4 Running on Device: "Could not find an installed version of Gradle either on Android Studio or in System" Although I have it on my system

I'm trying to run a blank app of ionic 4 on my android 9 device. Already followed each step on the website and running it on browser is okay.
When I run it on my device here is what i get:
Error when running
It says I dont have gradle and android studio but here is my environment:
android sdk list,my /etc/environment,and my npm, ionic, gradle and java versions
Am I missing something guys?
This error occurs when gradle is not properly installed. I have experienced this before. try installing gradle on your system.
For some reason the ionic project does not locate the gradle, to verify that this is the case, try opening the project on android studio and you will get the warning that no gradle wrapper was found.
IDK if some of you people have the same problem, but it's because of the Gradle. Installed it the way the website said, tried both automatically with SDK manager and also the manual downloads. Still no. So I installed it using:
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle
Then find location where it was installed then add to path. Now I can install the app on my device
Your question is not clear, are you facing error on local emulator or real mobile device?
it seems you are trying to run on local android emulator, can you please mention that where you are facing error?
Also, please do debug or production build with the help of ionic cordova build android command and try to run on your android device, generally android studio will pops up of gradle build update, which will help to generate faster sequential android build, and which needs gradle for it.

Installation failed with message Failed to commit install session

Getting an error message while trying to run an apk through android studio 3.4 canary 1.
Gradle plugin version com.android.tools.build:gradle:3.4.0-alpha01
Installation failed with message Failed to commit install session 526049657 with command cmd package install-commit 526049657.. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
I have tried uninstalling the apk, restarting android studio and the device and invalidating caches and rebuilding but nothing seems to work.
I disabled "Instant Run" in settings, and it works for me.(Android Studio 3.4 canary)
Then you can see the adb command executed in the terminal is "adb push", while it is "adb install-multiple" before that is disabled.
On Android studio go to build menu :
Build menu
Then:
First Clean
Rebuild
run it again
*******It works well **********
build->clean project
rebuild project
Delete as shown below
Disable "Instant Run".
File->Setting->Build, Execution, Deployment->Instant Run-> unCheck (Enable Instant Run to hot swap code/resource changes on deploy)
and Run your Project and after that go and Enable Instant Run to use the advantages of Instant Run
If you have a version of the APK installed on a device/emulator and you create a new version of the APK that compiles against an SDK above the device/emulator sdk, you get this error vs. the original "yo, you are targeting 28 and this device has 26... come one, you need a 28 device/emulator".
You have to actually turn off instant run to see the right error.
Why would you do this? Good question! I mixed up my Q vs P devices and wasted an hour trying to figure out what was going on. :P
Most easy solution is, wipe data of your emulator and run project again.
I had fixed this problem by getting rid of the meta data section in my manifest. I have no clue how it was added to the manifest to begin with (I'm a noob), but once I removed it from the manifest, the app loaded right up.
<Activity
...
/>
remove the meta data line within the manifest and it should work.
This is what worked for me
Build > Clean Project
File > Invalidate Caches & Restart
Just checked In AndroidMainfest file is not complaining any issue.
I have updated targetSDK version 33 and it required "android:export" flag in activity section

Categories

Resources